Skip to content

Commit d78d610

Browse files
authored
Merge pull request eugenp#8269 from radhe-sravan/master
Circular linked list Java implementation
2 parents 64ba156 + bd59391 commit d78d610

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

data-structures/src/main/java/com/baeldung/list/CircularLinkedList.java renamed to data-structures/src/main/java/com/baeldung/circularlinkedlist/CircularLinkedList.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.baeldung.list;
1+
package com.baeldung.circularlinkedlist;
22

33
import org.slf4j.Logger;
44
import org.slf4j.LoggerFactory;
@@ -49,13 +49,11 @@ public void deleteNode(int valueToDelete) {
4949
if (currentNode.value == valueToDelete) {
5050
head = head.nextNode;
5151
tail.nextNode = head;
52-
currentNode = null;
5352
} else {
5453
do {
5554
Node nextNode = currentNode.nextNode;
5655
if (nextNode.value == valueToDelete) {
5756
currentNode.nextNode = nextNode.nextNode;
58-
nextNode = null;
5957
break;
6058
}
6159
currentNode = currentNode.nextNode;

data-structures/src/test/java/com/baeldung/list/CircularLinkedListUnitTest.java renamed to data-structures/src/test/java/com/baeldung/circularlinkedlist/CircularLinkedListUnitTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.baeldung.list;
1+
package com.baeldung.circularlinkedlist;
22

33
import static org.junit.Assert.assertFalse;
44
import static org.junit.Assert.assertTrue;

0 commit comments

Comments
 (0)