java.lang.Object
org.eclipse.persistence.internal.helper.linkedlist.ExposedNodeLinkedList
All Implemented Interfaces:
Iterable, Collection, List, SequencedCollection

public class ExposedNodeLinkedList extends Object implements List
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 Details

    • ExposedNodeLinkedList

      public ExposedNodeLinkedList()
      Constructs an empty list.
  • Method Details

    • toArray

      public Object[] toArray(Object[] array)
      Specified by:
      toArray in interface Collection
      Specified by:
      toArray in interface List
    • toArray

      public Object[] toArray()
      Specified by:
      toArray in interface Collection
      Specified by:
      toArray in interface List
    • set

      public Object set(int index, Object value)
      Specified by:
      set in interface List
    • listIterator

      public ListIterator listIterator(int index)
      Specified by:
      listIterator in interface List
    • listIterator

      public ListIterator listIterator()
      Specified by:
      listIterator in interface List
    • iterator

      public Iterator iterator()
      Specified by:
      iterator in interface Collection
      Specified by:
      iterator in interface Iterable
      Specified by:
      iterator in interface List
    • subList

      public List subList(int start, int end)
      Specified by:
      subList in interface List
    • retainAll

      public boolean retainAll(Collection collection)
      Specified by:
      retainAll in interface Collection
      Specified by:
      retainAll in interface List
    • removeAll

      public boolean removeAll(Collection collection)
      Specified by:
      removeAll in interface Collection
      Specified by:
      removeAll in interface List
    • containsAll

      public boolean containsAll(Collection collection)
      Specified by:
      containsAll in interface Collection
      Specified by:
      containsAll in interface List
    • addAll

      public boolean addAll(Collection collection)
      Specified by:
      addAll in interface Collection
      Specified by:
      addAll in interface List
    • addAll

      public boolean addAll(int index, Collection collection)
      Specified by:
      addAll in interface List
    • remove

      public boolean remove(Object object)
      Specified by:
      remove in interface Collection
      Specified by:
      remove in interface List
    • add

      public boolean add(Object object)
      Specified by:
      add in interface Collection
      Specified by:
      add in interface List
    • lastIndexOf

      public int lastIndexOf(Object object)
      Specified by:
      lastIndexOf in interface List
    • add

      public void add(int index, Object object)
      Specified by:
      add in interface List
    • remove

      public Object remove(int index)
      Specified by:
      remove in interface List
    • get

      public Object get(int index)
      Specified by:
      get in interface List
    • isEmpty

      public boolean isEmpty()
      Specified by:
      isEmpty in interface Collection
      Specified by:
      isEmpty in interface List
    • getFirst

      public Object getFirst()
      Returns the first contents in this list.
      Specified by:
      getFirst in interface List
      Specified by:
      getFirst in interface SequencedCollection
      Returns:
      the first contents in this list. Null if this list is empty.
    • getLast

      public Object getLast()
      Returns the last contents in this list.
      Specified by:
      getLast in interface List
      Specified by:
      getLast in interface SequencedCollection
      Returns:
      the last contents in this list. Null if this list is empty.
    • removeFirst

      public Object removeFirst()
      Removes and returns the first contents from this list.
      Specified by:
      removeFirst in interface List
      Specified by:
      removeFirst in interface SequencedCollection
      Returns:
      the first contents from this list.
      Throws:
      NoSuchElementException - if this list is empty.
    • removeLast

      public Object removeLast()
      Removes and returns the last contents from this list.
      Specified by:
      removeLast in interface List
      Specified by:
      removeLast in interface SequencedCollection
      Returns:
      the last contents from this list.
      Throws:
      NoSuchElementException - if this list is empty.
    • addFirst

      public LinkedNode addFirst(Object o)
      Inserts the given contents at the beginning of this list.
      Specified by:
      addFirst in interface List
      Specified by:
      addFirst in interface SequencedCollection
      Parameters:
      o - the contents to be inserted at the beginning of this list.
    • addLast

      public LinkedNode addLast(Object o)
      Appends the given contents to the end of this list. (Identical in function to the add method; included only for consistency.)
      Specified by:
      addLast in interface List
      Specified by:
      addLast in interface SequencedCollection
      Parameters:
      o - the contents to be inserted at the end of this list.
    • contains

      public boolean contains(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:
      contains in interface Collection
      Specified by:
      contains in interface 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:
      size in interface Collection
      Specified by:
      size in interface List
      Returns:
      the number of contents in this list.
    • clear

      public void clear()
      Removes all of the contents from this list.
      Specified by:
      clear in interface Collection
      Specified by:
      clear in interface List
    • indexOf

      public int indexOf(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:
      indexOf in interface 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.