forked from bmwatson2/p2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathListnode.java
41 lines (34 loc) · 845 Bytes
/
Listnode.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/**
* This is the structure for a singly linked list node
* Consists of the data to be stored in the node
* and the link to the next node in the list
* @param <E>
*/
public class Listnode<E>{
/** The data members
* data: Holds the value of each node in the list
* next: Holds the link to the next node in list
*/
private E data;
private Listnode<E> next;
public Listnode(E data) {
this.data = data;
this.next = null;
}
public Listnode(E data, Listnode<E> next) {
this.data = data;
this.next = next;
}
public E getData() {
return data;
}
public void setData(E data) {
this.data = data;
}
public Listnode<E> getNext() {
return next;
}
public void setNext(Listnode<E> next) {
this.next = next;
}
}