AbstractSequentialList
Defined in: src/abstract/AbstractSequentialList.ts:15
Skeleton implementation of the List interface for sequential (linked) storage: positional operations
(get, set, add(index, e), removeAt, addAll(index, c)) walk listIterator(index), so each costs O(index).
A subclass implements listIterator(index) and size(). For a modifiable list, the list iterator must support
set, add and remove; the class does its own modCount tracking in that iterator, incrementing modCount
on each structural change and throwing ConcurrentModificationException when it changes behind the
iterator. Do not add the RandomAccess brand.
Extends
Section titled “Extends”AbstractList<E>
Extended by
Section titled “Extended by”Type Parameters
Section titled “Type Parameters”E
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new AbstractSequentialList<
E>():AbstractSequentialList<E>
Returns
Section titled “Returns”AbstractSequentialList<E>
Inherited from
Section titled “Inherited from”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.
Inherited from
Section titled “Inherited from”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>
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
Inherited from
Section titled “Inherited from”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
Inherited from
Section titled “Inherited from”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
Inherited from
Section titled “Inherited from”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
Inherited from
Section titled “Inherited from”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
Inherited from
Section titled “Inherited from”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
Inherited from
Section titled “Inherited from”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
Inherited from
Section titled “Inherited from”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
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
Inherited from
Section titled “Inherited from”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
Inherited from
Section titled “Inherited from”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
Inherited from
Section titled “Inherited from”get(
index):E
Defined in: src/abstract/AbstractSequentialList.ts:27
Returns the element at index by walking a list iterator; O(index).
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”E
Throws
Section titled “Throws”IndexOutOfBoundsException if index < 0 || index >= size()
Overrides
Section titled “Overrides”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
Inherited from
Section titled “Inherited from”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
Inherited from
Section titled “Inherited from”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
Inherited from
Section titled “Inherited from”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
Inherited from
Section titled “Inherited from”isEmpty()
Section titled “isEmpty()”isEmpty():
boolean
Defined in: src/abstract/AbstractCollection.ts:29
Returns size() === 0.
Returns
Section titled “Returns”boolean
Inherited from
Section titled “Inherited from”iterator()
Section titled “iterator()”iterator():
Iterator<E>
Defined in: src/abstract/AbstractSequentialList.ts:73
Returns an iterator over the elements in order; it is listIterator(), so it fails fast the same way.
Returns
Section titled “Returns”Iterator<E>
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
Inherited from
Section titled “Inherited from”listIterator()
Section titled “listIterator()”
abstractlistIterator(index?):ListIterator<E>
Defined in: src/abstract/AbstractSequentialList.ts:21
Returns a list iterator starting at index (default 0). Subclasses implement it; every positional operation is
built on it.
Parameters
Section titled “Parameters”index?
Section titled “index?”number
Returns
Section titled “Returns”ListIterator<E>
Throws
Section titled “Throws”IndexOutOfBoundsException if index < 0 || index > size()
Overrides
Section titled “Overrides”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>
Inherited from
Section titled “Inherited from”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
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
Inherited from
Section titled “Inherited from”removeAt()
Section titled “removeAt()”removeAt(
index):E
Defined in: src/abstract/AbstractSequentialList.ts:55
Removes and returns the element at index through the list iterator’s remove.
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”E
Throws
Section titled “Throws”IndexOutOfBoundsException if index < 0 || index >= size()
Throws
Section titled “Throws”UnsupportedOperationException if the list iterator does not support remove
Overrides
Section titled “Overrides”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
Inherited from
Section titled “Inherited from”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
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
Inherited from
Section titled “Inherited from”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
Inherited from
Section titled “Inherited from”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
Inherited from
Section titled “Inherited from”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
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>
Inherited from
Section titled “Inherited from”set(
index,e):E
Defined in: src/abstract/AbstractSequentialList.ts:37
Replaces the element at index through the list iterator’s set and returns the old one.
Parameters
Section titled “Parameters”number
E
Returns
Section titled “Returns”E
Throws
Section titled “Throws”IndexOutOfBoundsException if index < 0 || index >= size()
Throws
Section titled “Throws”UnsupportedOperationException if the list iterator does not support set
Overrides
Section titled “Overrides”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
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
Inherited from
Section titled “Inherited from”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>
Inherited from
Section titled “Inherited from”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>
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
Inherited from
Section titled “Inherited from”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[]
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
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