public class NodeGeneric
1: //NodeGeneric.java
2: //To be used as a external (not nested) class.
4: public class NodeGeneric<T>
5: {
6: private T data; //Data in the node
7: private NodeGeneric<T> next; //Link to next node
9: //Two constructors
10: public NodeGeneric(T dataPortion)
11: {
12: this(dataPortion, null);
13: }
15: public NodeGeneric
16: (
17: T dataPortion,
18: NodeGeneric<T> nextNode
19: )
20: {
21: data = dataPortion;
22: next = nextNode;
23: }
25: //Two getters
26: public T getData()
27: {
28: return data;
29: }
31: public NodeGeneric<T> getNext()
32: {
33: return next;
34: }
36: //Two setters
37: public void setData(T data)
38: {
39: this.data = data;
40: }
42: public void setNext(NodeGeneric<T> next)
43: {
44: this.next = next;
45: }
46: }