-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNode.java
More file actions
47 lines (39 loc) · 825 Bytes
/
Copy pathNode.java
File metadata and controls
47 lines (39 loc) · 825 Bytes
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
43
44
45
46
47
/**
* Class: Node
*
* @Author: Kabir Bhakta 7900098
* @Purpose: becomes the nodes for different objects for our linked list data structure
*/
public class Node
{
//Instance variables
private ListItem data;
private Node next;
//Constructor
public Node(ListItem newData, Node newNext)
{
data = newData;
next = newNext;
}
//retrive data
public ListItem getData()
{
return data;
}
public void setData(ListItem item){
data = item;
}
//retrive next pointer
public Node getNext()
{
return next;
}
//set new next pointer
public void setNext(Node newNext)
{
next = newNext;
}
public Node clone(){
return new Node(this.getData(),this.getNext());
}
}