-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNodeClass.java
More file actions
45 lines (39 loc) · 824 Bytes
/
Copy pathNodeClass.java
File metadata and controls
45 lines (39 loc) · 824 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
/**
* @author Hechie#1558
*/
public class NodeClass<E> implements Node<E> {
private E elem;
private Node<E> nextNode;
/**
* Constructor from class NodeClass
* @param elem element to be added on the node
*/
public NodeClass(E elem) {
this.elem = elem;
this.nextNode = null;
}
/**
* Links this node to another one
* @param node node to be linked to this one
*/
@Override
public void link(Node<E> node) {
nextNode = node;
}
/**
* Obtains the element on the node
* @return element on the node
*/
@Override
public E getElem() {
return elem;
}
/**
* Obtains the linked node
* @return linked node
*/
@Override
public Node<E> next() {
return nextNode;
}
}