Class AbstractLinkedList<E>

java.lang.Object
org.apache.commons.collections4.list.AbstractLinkedList<E>
Type Parameters:
E - the type of elements in this list
All Implemented Interfaces:
Iterable<E>, Collection<E>, List<E>, SequencedCollection<E>
Direct Known Subclasses:
CursorableLinkedList, NodeCachingLinkedList

@Deprecated public abstract class AbstractLinkedList<E> extends Object implements List<E>
Deprecated.
An abstract implementation of a linked list which provides numerous points for subclasses to override.

Overridable methods are provided to change the storage node and to change how nodes are added to and removed. Hopefully, all you need for unusual subclasses is here.

Since:
3.0
  • Method Details

    • add

      public boolean add(E value)
      Deprecated.
      Specified by:
      add in interface Collection<E>
      Specified by:
      add in interface List<E>
    • add

      public void add(int index, E value)
      Deprecated.
      Specified by:
      add in interface List<E>
    • addAll

      public boolean addAll(Collection<? extends E> coll)
      Deprecated.
      Specified by:
      addAll in interface Collection<E>
      Specified by:
      addAll in interface List<E>
    • addAll

      public boolean addAll(int index, Collection<? extends E> coll)
      Deprecated.
      Specified by:
      addAll in interface List<E>
    • addFirst

      public boolean addFirst(E e)
      Deprecated.
      Adds an element at the beginning.
      Specified by:
      addFirst in interface List<E>
      Specified by:
      addFirst in interface SequencedCollection<E>
      Parameters:
      e - the element to beginning.
      Returns:
      true.
    • addLast

      public boolean addLast(E e)
      Deprecated.
      Adds an element at the end.
      Specified by:
      addLast in interface List<E>
      Specified by:
      addLast in interface SequencedCollection<E>
      Parameters:
      e - the element to add.
      Returns:
      true.
    • clear

      public void clear()
      Deprecated.
      Specified by:
      clear in interface Collection<E>
      Specified by:
      clear in interface List<E>
    • contains

      public boolean contains(Object value)
      Deprecated.
      Specified by:
      contains in interface Collection<E>
      Specified by:
      contains in interface List<E>
    • containsAll

      public boolean containsAll(Collection<?> coll)
      Deprecated.
      Specified by:
      containsAll in interface Collection<E>
      Specified by:
      containsAll in interface List<E>
    • equals

      public boolean equals(Object obj)
      Deprecated.
      Specified by:
      equals in interface Collection<E>
      Specified by:
      equals in interface List<E>
      Overrides:
      equals in class Object
    • get

      public E get(int index)
      Deprecated.
      Specified by:
      get in interface List<E>
    • getFirst

      public E getFirst()
      Deprecated.
      Gets the first element.
      Specified by:
      getFirst in interface List<E>
      Specified by:
      getFirst in interface SequencedCollection<E>
      Returns:
      the first element.
    • getLast

      public E getLast()
      Deprecated.
      Gets the last element.
      Specified by:
      getLast in interface List<E>
      Specified by:
      getLast in interface SequencedCollection<E>
      Returns:
      the last element.
    • hashCode

      public int hashCode()
      Deprecated.
      Specified by:
      hashCode in interface Collection<E>
      Specified by:
      hashCode in interface List<E>
      Overrides:
      hashCode in class Object
    • indexOf

      public int indexOf(Object value)
      Deprecated.
      Specified by:
      indexOf in interface List<E>
    • isEmpty

      public boolean isEmpty()
      Deprecated.
      Specified by:
      isEmpty in interface Collection<E>
      Specified by:
      isEmpty in interface List<E>
    • iterator

      public Iterator<E> iterator()
      Deprecated.
      Specified by:
      iterator in interface Collection<E>
      Specified by:
      iterator in interface Iterable<E>
      Specified by:
      iterator in interface List<E>
    • lastIndexOf

      public int lastIndexOf(Object value)
      Deprecated.
      Specified by:
      lastIndexOf in interface List<E>
    • listIterator

      public ListIterator<E> listIterator()
      Deprecated.
      Specified by:
      listIterator in interface List<E>
    • listIterator

      public ListIterator<E> listIterator(int fromIndex)
      Deprecated.
      Specified by:
      listIterator in interface List<E>
    • remove

      public E remove(int index)
      Deprecated.
      Specified by:
      remove in interface List<E>
    • remove

      public boolean remove(Object value)
      Deprecated.
      Specified by:
      remove in interface Collection<E>
      Specified by:
      remove in interface List<E>
    • removeAll

      public boolean removeAll(Collection<?> coll)
      Deprecated.

      This implementation iterates over the elements of this list, checking each element in turn to see if it's contained in coll. If it's contained, it's removed from this list. As a consequence, it is advised to use a collection type for coll that provides a fast (for example O(1)) implementation of Collection.contains(Object).

      Specified by:
      removeAll in interface Collection<E>
      Specified by:
      removeAll in interface List<E>
    • removeFirst

      public E removeFirst()
      Deprecated.
      Removes the first element.
      Specified by:
      removeFirst in interface List<E>
      Specified by:
      removeFirst in interface SequencedCollection<E>
      Returns:
      The value removed.
    • removeLast

      public E removeLast()
      Deprecated.
      Removes the last element.
      Specified by:
      removeLast in interface List<E>
      Specified by:
      removeLast in interface SequencedCollection<E>
      Returns:
      The value removed.
    • retainAll

      public boolean retainAll(Collection<?> coll)
      Deprecated.

      This implementation iterates over the elements of this list, checking each element in turn to see if it's contained in coll. If it's not contained, it's removed from this list. As a consequence, it is advised to use a collection type for coll that provides a fast (for example O(1)) implementation of Collection.contains(Object).

      Specified by:
      retainAll in interface Collection<E>
      Specified by:
      retainAll in interface List<E>
    • set

      public E set(int index, E value)
      Deprecated.
      Specified by:
      set in interface List<E>
    • size

      public int size()
      Deprecated.
      Specified by:
      size in interface Collection<E>
      Specified by:
      size in interface List<E>
    • subList

      public List<E> subList(int fromIndexInclusive, int toIndexExclusive)
      Deprecated.
      Gets a sublist of the main list.
      Specified by:
      subList in interface List<E>
      Parameters:
      fromIndexInclusive - the index to start from
      toIndexExclusive - the index to end at
      Returns:
      the new sublist
    • toArray

      public Object[] toArray()
      Deprecated.
      Specified by:
      toArray in interface Collection<E>
      Specified by:
      toArray in interface List<E>
    • toArray

      public <T> T[] toArray(T[] array)
      Deprecated.
      Specified by:
      toArray in interface Collection<E>
      Specified by:
      toArray in interface List<E>
    • toString

      public String toString()
      Deprecated.
      Overrides:
      toString in class Object