forked from reeucq/advanced-data-structures
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDoublyNode.java
42 lines (39 loc) · 1.03 KB
/
DoublyNode.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
42
/**
* Node class for the doubly linked list
* This class is used to create a node for the doubly linked list
*/
public class DoublyNode {
/** Data Members */
Object data; // data stored in the node
DoublyNode llink; // reference to the previous node
DoublyNode rlink; // reference to the next node
/**
* Constructor
* Creates a node that is empty
*/
public DoublyNode() {
data = null;
llink = null;
rlink = null;
}
/**
* Constructor
* @param data the data to be stored in the node
*/
public DoublyNode(Object data) {
this.data = data;
llink = null;
rlink = null;
}
/**
* Constructor
* @param data the data to be stored in the node
* @param llink the reference to the previous node
* @param rlink the reference to the next node
*/
public DoublyNode(Object data, DoublyNode llink, DoublyNode rlink) {
this.data = data;
this.llink = llink;
this.rlink = rlink;
}
}