java.util.LinkedList is one of the Collections data types. The purpose of the Collections is to provide service structures without stopping the programmer from worrying about his internal implementation. If you have internal functions that work in a certain way, and java.util does not guarantee that they work, then they are not for you.
To implement a circular linked list, first create a ListNode class:
class ListNode { ListNode next; ListNode prev; Object data; }
Then save the ListNode head and make sure that prev of head points to the "end" of the list and next "end" points to head . Honestly, there is a slight difference between a bidirectional list containing a pointer to a tail and a circular linked list.
Borealid
source share