ConcurrentLinkedList

A very simple linked list that supports concurrent access. Internally, it uses immutable objects. It uses recursion and is not meant for long lists.

Methods
void add(K obj)
Add an element at the end.
void add(K obj)
Add an element at the end.
Parameters:
obj - the element
Iterator iterator()
Get an iterator over all entries.
Iterator iterator()
Get an iterator over all entries.
Returns:
the iterator
K peekFirst()
Get the first element, or null if none.
K peekFirst()
Get the first element, or null if none.
Returns:
the first element
K peekLast()
Get the last element, or null if none.
K peekLast()
Get the last element, or null if none.
Returns:
the last element
boolean removeFirst(K obj)
Remove the first element, if it matches.
boolean removeFirst(K obj)
Remove the first element, if it matches.
Parameters:
obj - the element to remove
Returns:
true if the element matched and was removed
boolean removeLast(K obj)
Remove the last element, if it matches.
boolean removeLast(K obj)
Remove the last element, if it matches.
Parameters:
obj - the element to remove
Returns:
true if the element matched and was removed

Fields
static ConcurrentLinkedList.Entry NULL
static ConcurrentLinkedList.Entry head

NULL

The sentinel entry.

The head entry.