diff options
Diffstat (limited to 'src/de/ostfalia/algo/ws18/s1/LinkedListNode.java')
| -rw-r--r-- | src/de/ostfalia/algo/ws18/s1/LinkedListNode.java | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/src/de/ostfalia/algo/ws18/s1/LinkedListNode.java b/src/de/ostfalia/algo/ws18/s1/LinkedListNode.java new file mode 100644 index 0000000..a7cf4f1 --- /dev/null +++ b/src/de/ostfalia/algo/ws18/s1/LinkedListNode.java @@ -0,0 +1,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; + } +} |
