AbstractList
Defined in: src/abstract/AbstractList.ts:35
Skeleton implementation of the List interface for storage with fast positional access.
A read-only subclass implements get(index) and size(). It inherits fail-fast iterators and list iterators,
indexOf/lastIndexOf, live subList views, reversed(), sort, replaceAll, the sequenced methods
(getFirst, removeLast, …), value equals/hashCode with any List, and an index-based spliterator when
the list carries the RandomAccess brand (the brand is not added for you).
To be modifiable, override set(index, e); to grow and shrink, also override addAtIndex(index, e) and
removeAt(index). All three throw UnsupportedOperationException by default. Every add/addAll
overload, addFirst/addLast, list-iterator add and subList(...).add end in addAtIndex, so override that
hook rather than the overloaded add. Each structural change (one that changes the size) MUST increment
modCount, so iterators, sublists and spliterators fail fast with ConcurrentModificationException; set
is not structural.
Extends
Section titled “Extends”Extended by
Section titled “Extended by”Type Parameters
Section titled “Type Parameters”E
Implements
Section titled “Implements”List<E>
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new AbstractList<
E>():AbstractList<E>
Returns
Section titled “Returns”AbstractList<E>
Inherited from
Section titled “Inherited from”AbstractCollection.constructor
Properties
Section titled “Properties”modCount
Section titled “modCount”modCount:
number=0
Defined in: src/abstract/AbstractList.ts:41
Structural modification counter. Iterators, sublists and spliterators record it and throw
ConcurrentModificationException when it changes behind them. Subclasses increment it once per
structural change (add, remove, clear); set leaves it alone.
Methods
Section titled “Methods”[INSPECT]()
Section titled “[INSPECT]()”[INSPECT]():
string
Defined in: src/abstract/AbstractCollection.ts:195
Node’s util.inspect hook: console.log prints the toString() form.
Returns
Section titled “Returns”string
Inherited from
Section titled “Inherited from”[iterator]()
Section titled “[iterator]()”[iterator]():
IterableIterator<E>
Defined in: src/abstract/AbstractCollection.ts:164
Makes the collection usable with for..of and spread; walks iterator().
Returns
Section titled “Returns”IterableIterator<E>
Implementation of
Section titled “Implementation of”List.[iterator]
Inherited from
Section titled “Inherited from”Call Signature
Section titled “Call Signature”add(
e):boolean
Defined in: src/abstract/AbstractList.ts:80
Appends e (via addAtIndex(size(), e)) and returns true.
Parameters
Section titled “Parameters”E
Returns
Section titled “Returns”boolean
Throws
Section titled “Throws”UnsupportedOperationException if addAtIndex is not overridden
Implementation of
Section titled “Implementation of”List.add
Overrides
Section titled “Overrides”Call Signature
Section titled “Call Signature”add(
index,e):void
Defined in: src/abstract/AbstractList.ts:86
Inserts e at index (via addAtIndex), shifting later elements right.
Parameters
Section titled “Parameters”number
E
Returns
Section titled “Returns”void
Throws
Section titled “Throws”IndexOutOfBoundsException if index < 0 || index > size() (when the subclass checks it)
Throws
Section titled “Throws”UnsupportedOperationException if addAtIndex is not overridden
Implementation of
Section titled “Implementation of”List.add
Overrides
Section titled “Overrides”AbstractCollection.add
addAll()
Section titled “addAll()”Call Signature
Section titled “Call Signature”addAll(
c):boolean
Defined in: src/abstract/AbstractList.ts:100
Appends the elements of c in its iteration order (via addAllAt); returns true if c was not empty.
Parameters
Section titled “Parameters”Collection<E>
Returns
Section titled “Returns”boolean
Throws
Section titled “Throws”NullPointerException if c is null
Implementation of
Section titled “Implementation of”List.addAll
Overrides
Section titled “Overrides”Call Signature
Section titled “Call Signature”addAll(
index,c):boolean
Defined in: src/abstract/AbstractList.ts:106
Inserts the elements of c at index in its iteration order (via addAllAt); returns true if c was not empty.
Parameters
Section titled “Parameters”number
Collection<E>
Returns
Section titled “Returns”boolean
Throws
Section titled “Throws”IndexOutOfBoundsException if index < 0 || index > size()
Throws
Section titled “Throws”NullPointerException if c is null
Implementation of
Section titled “Implementation of”List.addAll
Overrides
Section titled “Overrides”AbstractCollection.addAll
addFirst()
Section titled “addFirst()”addFirst(
e):void
Defined in: src/abstract/AbstractList.ts:237
Inserts e at index 0, via addAtIndex.
Parameters
Section titled “Parameters”E
Returns
Section titled “Returns”void
Throws
Section titled “Throws”UnsupportedOperationException if addAtIndex is not overridden
Implementation of
Section titled “Implementation of”List.addFirst
addLast()
Section titled “addLast()”addLast(
e):void
Defined in: src/abstract/AbstractList.ts:245
Appends e at the end, via addAtIndex.
Parameters
Section titled “Parameters”E
Returns
Section titled “Returns”void
Throws
Section titled “Throws”UnsupportedOperationException if addAtIndex is not overridden
Implementation of
Section titled “Implementation of”List.addLast
clear()
Section titled “clear()”clear():
void
Defined in: src/abstract/AbstractList.ts:152
Removes every element via removeRange(0, size()) (list-iterator remove calls).
Returns
Section titled “Returns”void
Throws
Section titled “Throws”UnsupportedOperationException if removeAt is not overridden and the list is not empty
Implementation of
Section titled “Implementation of”List.clear
Overrides
Section titled “Overrides”contains()
Section titled “contains()”contains(
o):boolean
Defined in: src/abstract/AbstractCollection.ts:34
Returns true if some element equals o (by Objects.equals); a linear scan of iterator().
Parameters
Section titled “Parameters”unknown
Returns
Section titled “Returns”boolean
Implementation of
Section titled “Implementation of”List.contains
Inherited from
Section titled “Inherited from”containsAll()
Section titled “containsAll()”containsAll(
c):boolean
Defined in: src/abstract/AbstractCollection.ts:83
Returns true if this collection contains every element of c (calls contains for each).
Parameters
Section titled “Parameters”Collection<unknown>
Returns
Section titled “Returns”boolean
Throws
Section titled “Throws”NullPointerException if c is null
Implementation of
Section titled “Implementation of”List.containsAll
Inherited from
Section titled “Inherited from”AbstractCollection.containsAll
equals()
Section titled “equals()”equals(
o):boolean
Defined in: src/abstract/AbstractList.ts:293
Returns true if o is a List with equal elements in the same order (any List implementation).
Parameters
Section titled “Parameters”unknown
Returns
Section titled “Returns”boolean
Implementation of
Section titled “Implementation of”List.equals
Overrides
Section titled “Overrides”forEach()
Section titled “forEach()”forEach(
action):void
Defined in: src/abstract/AbstractCollection.ts:157
Calls action for each element in iteration order.
Parameters
Section titled “Parameters”action
Section titled “action”(e) => void
Returns
Section titled “Returns”void
Throws
Section titled “Throws”NullPointerException if action is null
Implementation of
Section titled “Implementation of”List.forEach
Inherited from
Section titled “Inherited from”
abstractget(index):E
Defined in: src/abstract/AbstractList.ts:47
Returns the element at index. Subclasses implement it and should validate with Objects.checkIndex.
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”E
Throws
Section titled “Throws”IndexOutOfBoundsException if index < 0 || index >= size()
Implementation of
Section titled “Implementation of”List.get
getFirst()
Section titled “getFirst()”getFirst():
E
Defined in: src/abstract/AbstractList.ts:253
Returns the element at index 0.
Returns
Section titled “Returns”E
Throws
Section titled “Throws”NoSuchElementException if the list is empty
Implementation of
Section titled “Implementation of”List.getFirst
getLast()
Section titled “getLast()”getLast():
E
Defined in: src/abstract/AbstractList.ts:262
Returns the element at index size() - 1.
Returns
Section titled “Returns”E
Throws
Section titled “Throws”NoSuchElementException if the list is empty
Implementation of
Section titled “Implementation of”List.getLast
hashCode()
Section titled “hashCode()”hashCode():
number
Defined in: src/abstract/AbstractList.ts:303
Returns 31 * h + hashCode(e) over the elements, starting at 1, so equal lists hash the same.
Returns
Section titled “Returns”number
Implementation of
Section titled “Implementation of”List.hashCode
Overrides
Section titled “Overrides”indexOf()
Section titled “indexOf()”indexOf(
o):number
Defined in: src/abstract/AbstractList.ts:135
Returns the index of the first element equal to o, or -1; a forward scan with a list iterator.
Parameters
Section titled “Parameters”unknown
Returns
Section titled “Returns”number
Implementation of
Section titled “Implementation of”List.indexOf
isEmpty()
Section titled “isEmpty()”isEmpty():
boolean
Defined in: src/abstract/AbstractCollection.ts:29
Returns size() === 0.
Returns
Section titled “Returns”boolean
Implementation of
Section titled “Implementation of”List.isEmpty
Inherited from
Section titled “Inherited from”iterator()
Section titled “iterator()”iterator():
Iterator<E>
Defined in: src/abstract/AbstractList.ts:173
Returns a fail-fast iterator built on get/removeAt: it throws ConcurrentModificationException when
modCount changes other than through the iterator itself.
Returns
Section titled “Returns”Iterator<E>
Implementation of
Section titled “Implementation of”List.iterator
Overrides
Section titled “Overrides”lastIndexOf()
Section titled “lastIndexOf()”lastIndexOf(
o):number
Defined in: src/abstract/AbstractList.ts:142
Returns the index of the last element equal to o, or -1; a backward scan with a list iterator.
Parameters
Section titled “Parameters”unknown
Returns
Section titled “Returns”number
Implementation of
Section titled “Implementation of”List.lastIndexOf
listIterator()
Section titled “listIterator()”listIterator(
index?):ListIterator<E>
Defined in: src/abstract/AbstractList.ts:181
Returns a fail-fast list iterator starting at index, built on get/set/add(index, e)/removeAt.
Parameters
Section titled “Parameters”index?
Section titled “index?”number = 0
Returns
Section titled “Returns”ListIterator<E>
Throws
Section titled “Throws”IndexOutOfBoundsException if index < 0 || index > size()
Implementation of
Section titled “Implementation of”List.listIterator
parallelStream()
Section titled “parallelStream()”parallelStream():
Stream<E>
Defined in: src/abstract/AbstractCollection.ts:180
Returns a stream over spliterator() flagged as parallel.
Returns
Section titled “Returns”Stream<E>
Implementation of
Section titled “Implementation of”List.parallelStream
Inherited from
Section titled “Inherited from”AbstractCollection.parallelStream
remove()
Section titled “remove()”remove(
o):boolean
Defined in: src/abstract/AbstractCollection.ts:68
Removes the first element equal to o through the iterator’s remove(); returns true if one was removed.
Parameters
Section titled “Parameters”unknown
Returns
Section titled “Returns”boolean
Throws
Section titled “Throws”UnsupportedOperationException if the iterator does not support remove() and a match is found
Implementation of
Section titled “Implementation of”List.remove
Inherited from
Section titled “Inherited from”removeAll()
Section titled “removeAll()”removeAll(
c):boolean
Defined in: src/abstract/AbstractCollection.ts:108
Removes every element that c contains, through the iterator’s remove(); returns true if any was removed.
Parameters
Section titled “Parameters”Collection<unknown>
Returns
Section titled “Returns”boolean
Throws
Section titled “Throws”NullPointerException if c is null
Implementation of
Section titled “Implementation of”List.removeAll
Inherited from
Section titled “Inherited from”removeAt()
Section titled “removeAt()”removeAt(
_index):E
Defined in: src/abstract/AbstractList.ts:72
Removes and returns the element at index; shifts later elements left. Iterator remove(), removeFirst/
removeLast and the inherited removal methods use it. Overrides must increment modCount.
Parameters
Section titled “Parameters”_index
Section titled “_index”number
Returns
Section titled “Returns”E
Throws
Section titled “Throws”UnsupportedOperationException unless a subclass overrides it
Implementation of
Section titled “Implementation of”List.removeAt
removeFirst()
Section titled “removeFirst()”removeFirst():
E
Defined in: src/abstract/AbstractList.ts:271
Removes and returns the element at index 0, via removeAt.
Returns
Section titled “Returns”E
Throws
Section titled “Throws”NoSuchElementException if the list is empty
Implementation of
Section titled “Implementation of”List.removeFirst
removeIf()
Section titled “removeIf()”removeIf(
filter):boolean
Defined in: src/abstract/AbstractCollection.ts:128
Removes every element for which filter returns true, through the iterator’s remove(); returns true if
any was removed.
Parameters
Section titled “Parameters”filter
Section titled “filter”(e) => boolean
Returns
Section titled “Returns”boolean
Throws
Section titled “Throws”NullPointerException if filter is null
Implementation of
Section titled “Implementation of”List.removeIf
Inherited from
Section titled “Inherited from”removeLast()
Section titled “removeLast()”removeLast():
E
Defined in: src/abstract/AbstractList.ts:280
Removes and returns the last element, via removeAt.
Returns
Section titled “Returns”E
Throws
Section titled “Throws”NoSuchElementException if the list is empty
Implementation of
Section titled “Implementation of”List.removeLast
removeRange()
Section titled “removeRange()”removeRange(
fromIndex,toIndex):void
Defined in: src/abstract/AbstractList.ts:160
Removes [fromIndex, toIndex). Public so views can delegate.
Parameters
Section titled “Parameters”fromIndex
Section titled “fromIndex”number
toIndex
Section titled “toIndex”number
Returns
Section titled “Returns”void
Throws
Section titled “Throws”IndexOutOfBoundsException for a bad range, before anything is removed
replaceAll()
Section titled “replaceAll()”replaceAll(
operator):void
Defined in: src/abstract/AbstractList.ts:211
Replaces each element with operator(element), through the list iterator’s set.
Parameters
Section titled “Parameters”operator
Section titled “operator”(e) => E
Returns
Section titled “Returns”void
Throws
Section titled “Throws”NullPointerException if operator is null
Implementation of
Section titled “Implementation of”List.replaceAll
retainAll()
Section titled “retainAll()”retainAll(
c):boolean
Defined in: src/abstract/AbstractCollection.ts:118
Removes every element that c does not contain, through the iterator’s remove(); returns true if any was
removed.
Parameters
Section titled “Parameters”Collection<unknown>
Returns
Section titled “Returns”boolean
Throws
Section titled “Throws”NullPointerException if c is null
Implementation of
Section titled “Implementation of”List.retainAll
Inherited from
Section titled “Inherited from”reversed()
Section titled “reversed()”reversed():
List<E>
Defined in: src/abstract/AbstractList.ts:286
Returns a live reverse-ordered view; writes through it reach this list. reversed().reversed() is this list.
Returns
Section titled “Returns”List<E>
Implementation of
Section titled “Implementation of”List.reversed
set(
_index,_e):E
Defined in: src/abstract/AbstractList.ts:53
Replaces the element at index and returns the old one. Not structural: does not change modCount.
Parameters
Section titled “Parameters”_index
Section titled “_index”number
E
Returns
Section titled “Returns”E
Throws
Section titled “Throws”UnsupportedOperationException unless a subclass overrides it
Implementation of
Section titled “Implementation of”List.set
size()
Section titled “size()”
abstractsize():number
Defined in: src/abstract/AbstractCollection.ts:26
Returns the number of elements. Subclasses implement it.
Returns
Section titled “Returns”number
Implementation of
Section titled “Implementation of”List.size
Inherited from
Section titled “Inherited from”sort()
Section titled “sort()”sort(
c?):void
Defined in: src/abstract/AbstractList.ts:222
Sorts the list stably by c (natural ordering when null or omitted): sorts a copy, then writes it back with the
list iterator’s set, so it is not a structural change.
Parameters
Section titled “Parameters”Comparator<E> | null = null
Returns
Section titled “Returns”void
Throws
Section titled “Throws”ClassCastException if natural ordering meets values that cannot be compared
Implementation of
Section titled “Implementation of”List.sort
spliterator()
Section titled “spliterator()”spliterator():
Spliterator<E>
Defined in: src/abstract/AbstractList.ts:202
ORDERED|SIZED|SUBSIZED. RandomAccess lists get a late-binding, fail-fast, index-based spliterator that splits in halves; others one over iterator().
Returns
Section titled “Returns”Spliterator<E>
Implementation of
Section titled “Implementation of”List.spliterator
Overrides
Section titled “Overrides”AbstractCollection.spliterator
stream()
Section titled “stream()”stream():
Stream<E>
Defined in: src/abstract/AbstractCollection.ts:175
Returns a sequential stream over spliterator().
Returns
Section titled “Returns”Stream<E>
Implementation of
Section titled “Implementation of”List.stream
Inherited from
Section titled “Inherited from”subList()
Section titled “subList()”subList(
fromIndex,toIndex):List<E>
Defined in: src/abstract/AbstractList.ts:193
Returns a live view of [fromIndex, toIndex): changes through it write to this list, and a structural change made
to this list directly makes the view throw ConcurrentModificationException. Carries the
RandomAccess brand when this list does.
Parameters
Section titled “Parameters”fromIndex
Section titled “fromIndex”number
toIndex
Section titled “toIndex”number
Returns
Section titled “Returns”List<E>
Throws
Section titled “Throws”IndexOutOfBoundsException if fromIndex < 0 or toIndex > size()
Throws
Section titled “Throws”IllegalArgumentException if fromIndex > toIndex
Implementation of
Section titled “Implementation of”List.subList
toArray()
Section titled “toArray()”Call Signature
Section titled “Call Signature”toArray():
E[]
Defined in: src/abstract/AbstractCollection.ts:41
Returns a new array of the elements in iteration order.
Returns
Section titled “Returns”E[]
Implementation of
Section titled “Implementation of”List.toArray
Inherited from
Section titled “Inherited from”Call Signature
Section titled “Call Signature”toArray<
A>(generator):A
Defined in: src/abstract/AbstractCollection.ts:48
Copies the elements in iteration order into generator(size()) and returns that array.
Type Parameters
Section titled “Type Parameters”A extends WritableArrayLike<E>
Parameters
Section titled “Parameters”generator
Section titled “generator”(length) => A
receives the element count and returns a plain or typed array of at least that length
Returns
Section titled “Returns”A
Throws
Section titled “Throws”IndexOutOfBoundsException if the generated typed array is too short
Throws
Section titled “Throws”NullPointerException if generator or its result is null
Implementation of
Section titled “Implementation of”List.toArray
Inherited from
Section titled “Inherited from”toString()
Section titled “toString()”toString():
string
Defined in: src/abstract/AbstractCollection.ts:199
Returns [e1, e2, ...] in iteration order; an element that is this collection prints as (this Collection).
Returns
Section titled “Returns”string
Implementation of
Section titled “Implementation of”List.toString