Class ExposedNodeLinkedList
- java.lang.Object
-
- org.eclipse.persistence.internal.helper.linkedlist.ExposedNodeLinkedList
-
- All Implemented Interfaces:
java.lang.Iterable,java.util.Collection,java.util.List
public class ExposedNodeLinkedList extends java.lang.Object implements java.util.ListINTERNAL: 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
- Author:
- Gordon Yorke
- See Also:
LinkedNode
-
-
Constructor Summary
Constructors Constructor Description ExposedNodeLinkedList()Constructs an empty list.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(int index, java.lang.Object object)booleanadd(java.lang.Object object)booleanaddAll(int index, java.util.Collection collection)booleanaddAll(java.util.Collection collection)LinkedNodeaddFirst(java.lang.Object o)Inserts the given contents at the beginning of this list.LinkedNodeaddLast(java.lang.Object o)Appends the given contents to the end of this list.voidclear()Removes all of the contents from this list.booleancontains(java.lang.Object o)Returns true if this list contains the specified contents.booleancontainsAll(java.util.Collection collection)java.lang.Objectget(int index)java.lang.ObjectgetFirst()Returns the first contents in this list.java.lang.ObjectgetLast()Returns the last contents in this list.intindexOf(java.lang.Object o)Returns the index in this list of the first occurrence of the specified contents, or -1 if the List does not contain this contents.booleanisEmpty()java.util.Iteratoriterator()intlastIndexOf(java.lang.Object object)java.util.ListIteratorlistIterator()java.util.ListIteratorlistIterator(int index)voidmoveFirst(LinkedNode node)Allows a node to be efficiently moved first.java.lang.Objectremove(int index)booleanremove(java.lang.Object object)voidremove(LinkedNode n)Allows a node to be efficiently removed.booleanremoveAll(java.util.Collection collection)java.lang.ObjectremoveFirst()Removes and returns the first contents from this list.java.lang.ObjectremoveLast()Removes and returns the last contents from this list.booleanretainAll(java.util.Collection collection)java.lang.Objectset(int index, java.lang.Object value)intsize()Returns the number of contents in this list.java.util.ListsubList(int start, int end)java.lang.Object[]toArray()java.lang.Object[]toArray(java.lang.Object[] array)
-
-
-
Method Detail
-
toArray
public java.lang.Object[] toArray(java.lang.Object[] array)
- Specified by:
toArrayin interfacejava.util.Collection- Specified by:
toArrayin interfacejava.util.List
-
toArray
public java.lang.Object[] toArray()
- Specified by:
toArrayin interfacejava.util.Collection- Specified by:
toArrayin interfacejava.util.List
-
set
public java.lang.Object set(int index, java.lang.Object value)- Specified by:
setin interfacejava.util.List
-
listIterator
public java.util.ListIterator listIterator(int index)
- Specified by:
listIteratorin interfacejava.util.List
-
listIterator
public java.util.ListIterator listIterator()
- Specified by:
listIteratorin interfacejava.util.List
-
iterator
public java.util.Iterator iterator()
- Specified by:
iteratorin interfacejava.util.Collection- Specified by:
iteratorin interfacejava.lang.Iterable- Specified by:
iteratorin interfacejava.util.List
-
subList
public java.util.List subList(int start, int end)- Specified by:
subListin interfacejava.util.List
-
retainAll
public boolean retainAll(java.util.Collection collection)
- Specified by:
retainAllin interfacejava.util.Collection- Specified by:
retainAllin interfacejava.util.List
-
removeAll
public boolean removeAll(java.util.Collection collection)
- Specified by:
removeAllin interfacejava.util.Collection- Specified by:
removeAllin interfacejava.util.List
-
containsAll
public boolean containsAll(java.util.Collection collection)
- Specified by:
containsAllin interfacejava.util.Collection- Specified by:
containsAllin interfacejava.util.List
-
addAll
public boolean addAll(java.util.Collection collection)
- Specified by:
addAllin interfacejava.util.Collection- Specified by:
addAllin interfacejava.util.List
-
addAll
public boolean addAll(int index, java.util.Collection collection)- Specified by:
addAllin interfacejava.util.List
-
remove
public boolean remove(java.lang.Object object)
- Specified by:
removein interfacejava.util.Collection- Specified by:
removein interfacejava.util.List
-
add
public boolean add(java.lang.Object object)
- Specified by:
addin interfacejava.util.Collection- Specified by:
addin interfacejava.util.List
-
lastIndexOf
public int lastIndexOf(java.lang.Object object)
- Specified by:
lastIndexOfin interfacejava.util.List
-
add
public void add(int index, java.lang.Object object)- Specified by:
addin interfacejava.util.List
-
remove
public java.lang.Object remove(int index)
- Specified by:
removein interfacejava.util.List
-
get
public java.lang.Object get(int index)
- Specified by:
getin interfacejava.util.List
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmptyin interfacejava.util.Collection- Specified by:
isEmptyin interfacejava.util.List
-
getFirst
public java.lang.Object getFirst()
Returns the first contents in this list.- Returns:
- the first contents in this list. Null if this list is empty.
-
getLast
public java.lang.Object getLast()
Returns the last contents in this list.- Returns:
- the last contents in this list. Null if this list is empty.
-
removeFirst
public java.lang.Object removeFirst()
Removes and returns the first contents from this list.- Returns:
- the first contents from this list.
- Throws:
java.util.NoSuchElementException- if this list is empty.
-
removeLast
public java.lang.Object removeLast()
Removes and returns the last contents from this list.- Returns:
- the last contents from this list.
- Throws:
java.util.NoSuchElementException- if this list is empty.
-
addFirst
public LinkedNode addFirst(java.lang.Object o)
Inserts the given contents at the beginning of this list.- Parameters:
o- the contents to be inserted at the beginning of this list.
-
addLast
public LinkedNode addLast(java.lang.Object o)
Appends the given contents to the end of this list. (Identical in function to the add method; included only for consistency.)- Parameters:
o- the contents to be inserted at the end of this list.
-
contains
public boolean contains(java.lang.Object o)
Returns true if this list contains the specified contents. More formally, returns true if and only if this list contains at least one contents e such that (o==null ? e==null : o.equals(e)).- Specified by:
containsin interfacejava.util.Collection- Specified by:
containsin interfacejava.util.List- 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:
sizein interfacejava.util.Collection- Specified by:
sizein interfacejava.util.List- Returns:
- the number of contents in this list.
-
clear
public void clear()
Removes all of the contents from this list.- Specified by:
clearin interfacejava.util.Collection- Specified by:
clearin interfacejava.util.List
-
indexOf
public int indexOf(java.lang.Object o)
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.- Specified by:
indexOfin interfacejava.util.List- Parameters:
o- contents to search for.- Returns:
- the index in this list of the first occurrence of the specified contents, or -1 if the list does not contain this contents.
-
remove
public void remove(LinkedNode n)
Allows a node to be efficiently removed.
-
moveFirst
public void moveFirst(LinkedNode node)
Allows a node to be efficiently moved first.
-
-