Module org.eclipse.persistence.core
Class ExposedNodeLinkedList
java.lang.Object
org.eclipse.persistence.internal.helper.linkedlist.ExposedNodeLinkedList
- All Implemented Interfaces:
Iterable
,Collection
,List
,SequencedCollection
INTERNAL:
A custom implementation of a linked list. This list exposes the linked nodes
directly to the developer. It allows nodes to be referenced in code for quick
list manipulation (ie reshuffle, remove, or queuing)
It is specifically used in the EclipseLink cache write lock mechanism in order
to allow quick removal of objects from the list while still providing the getFirst()
addLast() functionality of a queue. The alternative java classes LinkedList, LinkedHashMap
do not provide both functional requirements.
- Since:
- 10.0.3
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
boolean
boolean
addAll
(int index, Collection collection) boolean
addAll
(Collection collection) Inserts the given contents at the beginning of this list.Appends the given contents to the end of this list.void
clear()
Removes all of the contents from this list.boolean
Returnstrue
if this list contains the specified contents.boolean
containsAll
(Collection collection) get
(int index) getFirst()
Returns the first contents in this list.getLast()
Returns the last contents in this list.int
Returns the index in this list of the first occurrence of the specified contents, or -1 if the List does not contain this contents.boolean
isEmpty()
iterator()
int
lastIndexOf
(Object object) listIterator
(int index) void
moveFirst
(LinkedNode node) Allows a node to be efficiently moved first.remove
(int index) boolean
void
remove
(LinkedNode n) Allows a node to be efficiently removed.boolean
removeAll
(Collection collection) Removes and returns the first contents from this list.Removes and returns the last contents from this list.boolean
retainAll
(Collection collection) int
size()
Returns the number of contents in this list.subList
(int start, int end) Object[]
toArray()
Object[]
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
Methods inherited from interface java.util.List
equals, hashCode, replaceAll, reversed, sort, spliterator
-
Constructor Details
-
ExposedNodeLinkedList
public ExposedNodeLinkedList()Constructs an empty list.
-
-
Method Details
-
toArray
- Specified by:
toArray
in interfaceCollection
- Specified by:
toArray
in interfaceList
-
toArray
- Specified by:
toArray
in interfaceCollection
- Specified by:
toArray
in interfaceList
-
set
-
listIterator
- Specified by:
listIterator
in interfaceList
-
listIterator
- Specified by:
listIterator
in interfaceList
-
iterator
-
subList
-
retainAll
- Specified by:
retainAll
in interfaceCollection
- Specified by:
retainAll
in interfaceList
-
removeAll
- Specified by:
removeAll
in interfaceCollection
- Specified by:
removeAll
in interfaceList
-
containsAll
- Specified by:
containsAll
in interfaceCollection
- Specified by:
containsAll
in interfaceList
-
addAll
- Specified by:
addAll
in interfaceCollection
- Specified by:
addAll
in interfaceList
-
addAll
-
remove
- Specified by:
remove
in interfaceCollection
- Specified by:
remove
in interfaceList
-
add
- Specified by:
add
in interfaceCollection
- Specified by:
add
in interfaceList
-
lastIndexOf
- Specified by:
lastIndexOf
in interfaceList
-
add
-
remove
-
get
-
isEmpty
public boolean isEmpty()- Specified by:
isEmpty
in interfaceCollection
- Specified by:
isEmpty
in interfaceList
-
getFirst
Returns the first contents in this list.- Specified by:
getFirst
in interfaceList
- Specified by:
getFirst
in interfaceSequencedCollection
- Returns:
- the first contents in this list. Null if this list is empty.
-
getLast
Returns the last contents in this list.- Specified by:
getLast
in interfaceList
- Specified by:
getLast
in interfaceSequencedCollection
- Returns:
- the last contents in this list. Null if this list is empty.
-
removeFirst
Removes and returns the first contents from this list.- Specified by:
removeFirst
in interfaceList
- Specified by:
removeFirst
in interfaceSequencedCollection
- Returns:
- the first contents from this list.
- Throws:
NoSuchElementException
- if this list is empty.
-
removeLast
Removes and returns the last contents from this list.- Specified by:
removeLast
in interfaceList
- Specified by:
removeLast
in interfaceSequencedCollection
- Returns:
- the last contents from this list.
- Throws:
NoSuchElementException
- if this list is empty.
-
addFirst
Inserts the given contents at the beginning of this list.- Specified by:
addFirst
in interfaceList
- Specified by:
addFirst
in interfaceSequencedCollection
- Parameters:
o
- the contents to be inserted at the beginning of this list.
-
addLast
Appends the given contents to the end of this list. (Identical in function to theadd
method; included only for consistency.)- Specified by:
addLast
in interfaceList
- Specified by:
addLast
in interfaceSequencedCollection
- Parameters:
o
- the contents to be inserted at the end of this list.
-
contains
Returnstrue
if this list contains the specified contents. More formally, returnstrue
if and only if this list contains at least one contentse
such that(o==null ? e==null : o.equals(e))
.- Specified by:
contains
in interfaceCollection
- Specified by:
contains
in interfaceList
- Parameters:
o
- contents whose presence in this list is to be tested.- Returns:
true
if this list contains the specified contents.
-
size
public int size()Returns the number of contents in this list.- Specified by:
size
in interfaceCollection
- Specified by:
size
in interfaceList
- Returns:
- the number of contents in this list.
-
clear
public void clear()Removes all of the contents from this list.- Specified by:
clear
in interfaceCollection
- Specified by:
clear
in interfaceList
-
indexOf
Returns the index in this list of the first occurrence of the specified contents, or -1 if the List does not contain this contents. More formally, returns the lowest index i such that(o==null ? get(i)==null : o.equals(get(i)))
, or -1 if there is no such index. -
remove
Allows a node to be efficiently removed. -
moveFirst
Allows a node to be efficiently moved first.
-