I thought that an object is eligible for Garbage Collection once it is not referenced by any other thing (object or variable). ref : https://stackoverflow.com/a/13144938
But In Java linked list source code
Here not only the author removes any references to it, but he also goes on to remove what it refers to . Why is this needed ? Am I missing something in my understanding about Garbage Collection ?