Skip to content

Commit 818b34c

Browse files
committed
Node implementation
1 parent 184364b commit 818b34c

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

Node.java

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package ch04;
2+
3+
public class Node<T> {
4+
private T data;
5+
private Node<T> nextNode;
6+
7+
public Node(T data) {
8+
this.data = data;
9+
}
10+
11+
public T getData() {
12+
return data;
13+
}
14+
15+
public Node<T> getNextNode() {
16+
return nextNode;
17+
}
18+
19+
public void setNextNode(Node<T> nextNode) {
20+
this.nextNode = nextNode;
21+
}
22+
23+
@Override
24+
public String toString() {
25+
return "Data: " + this.data;
26+
}
27+
28+
}

0 commit comments

Comments
 (0)