Skip to content

Commit 6843959

Browse files
Update List.java
1 parent 7ebd229 commit 6843959

File tree

1 file changed

+3
-2
lines changed
  • algorithms/src/main/java/ivanmarkovic/algorithms/linkedlists/circularsinglylinkedlist

1 file changed

+3
-2
lines changed

algorithms/src/main/java/ivanmarkovic/algorithms/linkedlists/circularsinglylinkedlist/List.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,9 @@ public Integer deleteFromTail() {
9898
public void deleteNodesWithValue(int value) {
9999
if(this.isEmpty())
100100
throw new NoSuchElementException();
101-
if(this.head == this.tail && this.head.payload == value) {
102-
this.deleteFromHead();
101+
if(this.head == this.tail) {
102+
if(this.head.payload == value)
103+
this.deleteFromHead();
103104
return;
104105
}
105106
Node node = this.head;

0 commit comments

Comments
 (0)