Class AbstractLinkedListJava21<E>
- Type Parameters:
E- the type of elements in this list
- All Implemented Interfaces:
Iterable<E>,Collection<E>,List<E>,SequencedCollection<E>
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.
This is a copy of AbstractLinkedList, modified to be compatible with Java 21 (see COLLECTIONS-842 for details).
- Since:
- 4.5.0-M3
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoidbooleanbooleanaddAll(int index, Collection<? extends E> coll) booleanaddAll(Collection<? extends E> coll) voidvoidvoidclear()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
-
add
-
add
-
addAll
-
addAll
-
addFirst
-
addLast
-
clear
public void clear() -
contains
-
containsAll
- Specified by:
containsAllin interfaceCollection<E>- Specified by:
containsAllin interfaceList<E>
-
equals
-
get
-
getFirst
-
getLast
-
hashCode
public int hashCode() -
indexOf
-
isEmpty
public boolean isEmpty() -
iterator
-
lastIndexOf
- Specified by:
lastIndexOfin interfaceList<E>
-
listIterator
- Specified by:
listIteratorin interfaceList<E>
-
listIterator
- Specified by:
listIteratorin interfaceList<E>
-
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 (for example O(1)) implementation ofCollection.contains(Object). -
removeFirst
- Specified by:
removeFirstin interfaceList<E>- Specified by:
removeFirstin interfaceSequencedCollection<E>
-
removeLast
- Specified by:
removeLastin interfaceList<E>- Specified by:
removeLastin interfaceSequencedCollection<E>
-
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 (for example O(1)) implementation ofCollection.contains(Object). -
set
-
size
public int size() -
subList
Gets a sublist of the main list. -
toArray
-
toArray
public <T> T[] toArray(T[] array) -
toString
-