Fixed the review comments
This commit is contained in:
		
							parent
							
								
									c865567b71
								
							
						
					
					
						commit
						5ca67c9ac7
					
				| @ -1,4 +1,4 @@ | |||||||
| package com.baeldung.list; | package com.baeldung.circularlinkedlist; | ||||||
| 
 | 
 | ||||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||||
| @ -49,13 +49,11 @@ public class CircularLinkedList { | |||||||
|             if (currentNode.value == valueToDelete) { |             if (currentNode.value == valueToDelete) { | ||||||
|                 head = head.nextNode; |                 head = head.nextNode; | ||||||
|                 tail.nextNode = head; |                 tail.nextNode = head; | ||||||
|                 currentNode = null; |  | ||||||
|             } else { |             } else { | ||||||
|                 do { |                 do { | ||||||
|                     Node nextNode = currentNode.nextNode; |                     Node nextNode = currentNode.nextNode; | ||||||
|                     if (nextNode.value == valueToDelete) { |                     if (nextNode.value == valueToDelete) { | ||||||
|                         currentNode.nextNode = nextNode.nextNode; |                         currentNode.nextNode = nextNode.nextNode; | ||||||
|                         nextNode = null; |  | ||||||
|                         break; |                         break; | ||||||
|                     } |                     } | ||||||
|                     currentNode = currentNode.nextNode; |                     currentNode = currentNode.nextNode; | ||||||
| @ -1,10 +1,12 @@ | |||||||
| package com.baeldung.list; | package com.baeldung.circularlinkedlist; | ||||||
| 
 | 
 | ||||||
| import static org.junit.Assert.assertFalse; | import static org.junit.Assert.assertFalse; | ||||||
| import static org.junit.Assert.assertTrue; | import static org.junit.Assert.assertTrue; | ||||||
| 
 | 
 | ||||||
| import org.junit.Test; | import org.junit.Test; | ||||||
| 
 | 
 | ||||||
|  | import com.baeldung.circularlinkedlist.CircularLinkedList; | ||||||
|  | 
 | ||||||
| public class CircularLinkedListUnitTest { | public class CircularLinkedListUnitTest { | ||||||
| 
 | 
 | ||||||
|     @Test |     @Test | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user