-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNode.java
More file actions
48 lines (40 loc) · 843 Bytes
/
Copy pathNode.java
File metadata and controls
48 lines (40 loc) · 843 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
48
/* ***************************************************
* Michael Krueger
* 09/29/2024
*
* Node Class - handles any form of data
*************************************************** */
public class Node<Type>
{
private Type data;
private Node<Type> link;
// Default constructor (optional, but useful if you need to initialize with no data)
public Node() {
this.data = null;
this.link = null;
}
// constructor
public Node(Type data)
{
this.data = data;
this.link = null;
}
// accessor and mutator for the data component
public Type getData()
{
return this.data;
}
public void setData(Type data)
{
this.data = data;
}
// accessor and mutator for the link component
public Node<Type> getLink()
{
return this.link;
}
public void setLink(Node<Type> link)
{
this.link = link;
}
}