Class AbstractLinkedList<E>
- java.lang.Object
 - 
- org.apache.commons.collections4.list.AbstractLinkedList<E>
 
 
- 
- All Implemented Interfaces:
 java.lang.Iterable<E>,java.util.Collection<E>,java.util.List<E>
- Direct Known Subclasses:
 CursorableLinkedList,NodeCachingLinkedList
public abstract class AbstractLinkedList<E> extends java.lang.Object implements java.util.List<E>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 Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(int index, E value)booleanadd(E value)booleanaddAll(int index, java.util.Collection<? extends E> coll)booleanaddAll(java.util.Collection<? extends E> coll)booleanaddFirst(E o)booleanaddLast(E o)voidclear()booleancontains(java.lang.Object value)booleancontainsAll(java.util.Collection<?> coll)booleanequals(java.lang.Object obj)Eget(int index)EgetFirst()EgetLast()inthashCode()intindexOf(java.lang.Object value)booleanisEmpty()java.util.Iterator<E>iterator()intlastIndexOf(java.lang.Object value)java.util.ListIterator<E>listIterator()java.util.ListIterator<E>listIterator(int fromIndex)Eremove(int index)booleanremove(java.lang.Object value)booleanremoveAll(java.util.Collection<?> coll)EremoveFirst()EremoveLast()booleanretainAll(java.util.Collection<?> coll)Eset(int index, E value)intsize()java.util.List<E>subList(int fromIndexInclusive, int toIndexExclusive)Gets a sublist of the main list.java.lang.Object[]toArray()<T> T[]toArray(T[] array)java.lang.StringtoString() 
 - 
 
- 
- 
Method Detail
- 
size
public int size()
 
- 
isEmpty
public boolean isEmpty()
 
- 
iterator
public java.util.Iterator<E> iterator()
 
- 
listIterator
public java.util.ListIterator<E> listIterator()
- Specified by:
 listIteratorin interfacejava.util.List<E>
 
- 
listIterator
public java.util.ListIterator<E> listIterator(int fromIndex)
- Specified by:
 listIteratorin interfacejava.util.List<E>
 
- 
indexOf
public int indexOf(java.lang.Object value)
- Specified by:
 indexOfin interfacejava.util.List<E>
 
- 
lastIndexOf
public int lastIndexOf(java.lang.Object value)
- Specified by:
 lastIndexOfin interfacejava.util.List<E>
 
- 
contains
public boolean contains(java.lang.Object value)
 
- 
containsAll
public boolean containsAll(java.util.Collection<?> coll)
 
- 
toArray
public java.lang.Object[] toArray()
 
- 
toArray
public <T> T[] toArray(T[] array)
 
- 
subList
public java.util.List<E> subList(int fromIndexInclusive, int toIndexExclusive)
Gets a sublist of the main list.- Specified by:
 subListin interfacejava.util.List<E>- Parameters:
 fromIndexInclusive- the index to start fromtoIndexExclusive- the index to end at- Returns:
 - the new sublist
 
 
- 
add
public boolean add(E value)
 
- 
addAll
public boolean addAll(java.util.Collection<? extends E> coll)
 
- 
addAll
public boolean addAll(int index, java.util.Collection<? extends E> coll)- Specified by:
 addAllin interfacejava.util.List<E>
 
- 
remove
public boolean remove(java.lang.Object value)
 
- 
removeAll
public boolean removeAll(java.util.Collection<?> coll)
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 forcollthat provides a fast (e.g. O(1)) implementation ofCollection.contains(Object). 
- 
retainAll
public boolean retainAll(java.util.Collection<?> coll)
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 forcollthat provides a fast (e.g. O(1)) implementation ofCollection.contains(Object). 
- 
clear
public void clear()
 
- 
getFirst
public E getFirst()
 
- 
getLast
public E getLast()
 
- 
addFirst
public boolean addFirst(E o)
 
- 
addLast
public boolean addLast(E o)
 
- 
removeFirst
public E removeFirst()
 
- 
removeLast
public E removeLast()
 
- 
equals
public boolean equals(java.lang.Object obj)
 
- 
hashCode
public int hashCode()
 
- 
toString
public java.lang.String toString()
- Overrides:
 toStringin classjava.lang.Object
 
 - 
 
 -