summaryrefslogtreecommitdiff
path: root/src/de/ostfalia/algo/ws18/s1/LinkedListNode.java
blob: a7cf4f1e2051e31d7e665c5142ec4d90b01d3922 (plain)
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package de.ostfalia.algo.ws18.s1;

/**
 * A generic linked list node.
 * 
 * @param <E> The type of the value this node contains.
 */
public class LinkedListNode<E> {
	/**
	 * This node's value.
	 */
	private E value;
	/**
	 * The next linked node. 
	 */
	private LinkedListNode<E> next;
	
	/**
	 * Create a node with the given value and no next node.
	 * 
	 * @param value This node's value.
	 */
	public LinkedListNode(E value) {
		this.value = value;
		this.next = null;
	}
	
	/**
	 * Get this node's value.
	 * 
	 * @return This node's value.
	 */
	public E getValue() {
		return this.value;
	}
	
	/**
	 * Set this node's value.
	 * 
	 * @param value The new value.
	 */
	public void setValue(E value) {
		this.value = value;
	}
	
	/**
	 * Get the next linked node.
	 * 
	 * @return The next linked node.
	 */
	public LinkedListNode<E> getNext() {
		return this.next;
	}
	
	/**
	 * Set the next linked node.
	 * 
	 * @param next
	 */
	public void setNext(LinkedListNode<E> next) {
		this.next = next;
	}
}