如果对于一个已经创建好的链表进行如下操作:
singleLinkedList.head = singleLinkedList.head.next; singleLinkedList.list();
将链表头从第一个元素指向了第二个元素,那么链表头的元素会被回收。此时head指向第二个元素,第一个元素指向第二个元素,但没有东西再指向第一个元素。
更换链表头节点和JVM的回收
原文:https://www.cnblogs.com/LostSecretGarden/p/14680100.html