forked from TheAlgorithms/Java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNode.java
More file actions
42 lines (36 loc) · 804 Bytes
/
Node.java
File metadata and controls
42 lines (36 loc) · 804 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
package com.thealgorithms.devutils.nodes;
/**
* Base class for any node implementation which contains a generic type
* variable.
*
* All known subclasses: {@link TreeNode}, {@link SimpleNode}.
*
* @param <E> The type of the data held in the Node.
*
* @author <a href="https://github.com/aitorfi">aitorfi</a>
*/
public abstract class Node<E> {
/**
* Generic type data stored in the Node.
*/
private E data;
/**
* Empty constructor.
*/
public Node() {
}
/**
* Initializes the Nodes' data.
*
* @param data Value to which data will be initialized.
*/
public Node(E data) {
this.data = data;
}
public E getData() {
return data;
}
public void setData(E data) {
this.data = data;
}
}