Skip to content

Commit f5648ad

Browse files
author
Lord-of-Algorithms
committed
Fix return statement in delete operation for LinkedList head
1 parent c71a95e commit f5648ad

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/lineards/linkedlist/LinkedList.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ public void deleteByValue(char value) {
8585
if (head.data == value) {
8686
// Delete the head
8787
head = head.next;
88+
return;
8889
}
8990
Node pred = head;
9091
Node temp = head.next;
@@ -111,6 +112,7 @@ public void deleteLast() {
111112
if (head.next == null) {
112113
// There is only one node
113114
head = null;
115+
return;
114116
}
115117
Node pred = head;
116118
Node temp = head.next;

0 commit comments

Comments
 (0)