Class AbstractLinkedList<E>
- All Implemented Interfaces:
Iterable<E>,Collection<E>,List<E>,SequencedCollection<E>
- Direct Known Subclasses:
CursorableLinkedList,NodeCachingLinkedList
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
Modifier and TypeMethodDescriptionvoidbooleanbooleanaddAll(int index, Collection<? extends E> coll) booleanaddAll(Collection<? extends E> coll) booleanbooleanvoidclear()booleanbooleancontainsAll(Collection<?> coll) booleanget(int index) getFirst()getLast()inthashCode()intbooleanisEmpty()iterator()intlastIndexOf(Object value) listIterator(int fromIndex) remove(int index) booleanbooleanremoveAll(Collection<?> coll) booleanretainAll(Collection<?> coll) intsize()subList(int fromIndexInclusive, int toIndexExclusive) Gets a sublist of the main list.Object[]toArray()<T> T[]toArray(T[] array) toString()Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface java.util.List
replaceAll, reversed, sort, spliterator
-
Method Details
-
size
public int size() -
isEmpty
public boolean isEmpty() -
get
-
iterator
-
listIterator
- Specified by:
listIteratorin interfaceList<E>
-
listIterator
- Specified by:
listIteratorin interfaceList<E>
-
indexOf
-
lastIndexOf
- Specified by:
lastIndexOfin interfaceList<E>
-
contains
-
containsAll
- Specified by:
containsAllin interfaceCollection<E>- Specified by:
containsAllin interfaceList<E>
-
toArray
-
toArray
public <T> T[] toArray(T[] array) -
subList
Gets a sublist of the main list. -
add
-
add
-
addAll
-
addAll
-
remove
-
remove
-
removeAll
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
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). -
set
-
clear
public void clear() -
getFirst
-
getLast
-
addFirst
-
addLast
-
removeFirst
- Specified by:
removeFirstin interfaceList<E>- Specified by:
removeFirstin interfaceSequencedCollection<E>
-
removeLast
- Specified by:
removeLastin interfaceList<E>- Specified by:
removeLastin interfaceSequencedCollection<E>
-
equals
-
hashCode
public int hashCode() -
toString
-