aboutsummaryrefslogtreecommitdiffstats
path: root/src/datastructures/linkedlists/template
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-01-22 12:36:23 +0100
committerMattias Andrée <maandree@operamail.com>2014-01-22 12:36:23 +0100
commit564354ad8ef2044e68f5a26b155bfe0f4c9397c2 (patch)
treec30399b0cab41320a3759c197e198b760800933f /src/datastructures/linkedlists/template
parentadd circularly linked lists (diff)
downloadalgorithms-and-data-structures-564354ad8ef2044e68f5a26b155bfe0f4c9397c2.tar.gz
algorithms-and-data-structures-564354ad8ef2044e68f5a26b155bfe0f4c9397c2.tar.bz2
algorithms-and-data-structures-564354ad8ef2044e68f5a26b155bfe0f4c9397c2.tar.xz
add headless linked lists
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r--src/datastructures/linkedlists/template5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/datastructures/linkedlists/template b/src/datastructures/linkedlists/template
index 0a24a89..71c6a84 100644
--- a/src/datastructures/linkedlists/template
+++ b/src/datastructures/linkedlists/template
@@ -193,7 +193,7 @@
node.next = successor;
if (node.previous != null)
node.previous.next = node;
-£>if (( with_tail )); then
+£>if (( with_head )); then
if (this.head == successor)
this.head = node;
£>fi
@@ -252,7 +252,10 @@
public Node insertEnd(T value)
{
if (this.tail == null)
+£>(( with_head )) &&
return insertBeginning(value);
+£>(( with_head )) ||
+ return this.tail = new Node(value);
return insertAfter(value, this.tail);
}