mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-08 18:32:56 +08:00
@ -61,7 +61,9 @@ public class SinglyLinkedList {
|
|||||||
throw new RuntimeException("The list is empty!");
|
throw new RuntimeException("The list is empty!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Node destroy = head;
|
||||||
head = head.next;
|
head = head.next;
|
||||||
|
destroy = null; // clear to let GC do its work
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user