Readonly iteratorReturns true if all elements match the given predicate.
Returns true if at least one element match the given predicate.
Optional predicate: ((item) => boolean | Promise<boolean>)Returns an iterable representation of the sequence.
Returns a map consisting of the elements mapped by the given keySelector.
Returns a map consisting of the elements indexed by the given key.
Returns a map consisting of the elements mapped by the given keySelector. The value
is transformed into another value by the valueTransformer.
Returns a map consisting of the elements indexed by the given key. The value
is transformed into another value by the valueTransformer.
Returns the average of all numbers of the sequence or NaN if the sequence is empty.
Splits the elements of the sequence into arrays which length is determined by
the given chunkSize and returns all chunks as array.
Returns true if the sequence contains the given element.
Returns the number of elements of this sequence. If predicate is present, returns
the number of elements matching the given predicate.
Optional predicate: ((item) => boolean | Promise<boolean>)Returns a new sequence which discards all duplicate elements.
Returns a new sequence which discards all elements with duplicate items determined
by the given selector.
Returns a new sequence which discards the first n elements;
Drops all elements of the sequence as long as the given predicate evaluates to true.
Returns the element at position index (zero-based) or throws an error if index
is out of bounds.
Returns the element at position index (zero-based) or null if index
is out of bounds.
Returns a new sequence consisting of all elements that match the given predicate.
Returns a new sequence consisting of all elements that match the given predicate.
Returns a new sequence consisting of all elements that don't match the given predicate.
Returns a new sequence consisting of all non-null elements.
Returns the first element of the sequence or the first element matching predicate if present, otherwise returns null.
Optional predicate: ((item) => boolean | Promise<boolean>)Returns the last element of the sequence or the last element matching predicate if present, otherwise returns null.
Optional predicate: ((value) => boolean | Promise<boolean>)Returns the first element of the sequence or the first element matching predicate if present, otherwise throws
an error.
Optional predicate: ((item) => boolean | Promise<boolean>)Returns the first element of the sequence or the first element matching predicate if present, otherwise returns null.
Optional predicate: ((item) => boolean | Promise<boolean>)Transforms each element into a sequence of items and returns a flat single sequence of all those items.
Returns a single flat sequence of all the items from all sequences or iterables.
Accumulates all elements of the sequence into a single result by applying the given operation starting with
the initial value. The result of the last operation will be passed as accumulated value to the getNext invocation
of the operation until all elements of the sequence are processed.
Accumulates all elements of the sequence into a single result by applying the given operation starting with
the initial value. The result of the last operation will be passed as accumulated value to the getNext invocation
of the operation as well as the index of the current element (zero-based) until all elements of the sequence
are processed.
Performs the given action (side-effect) for each element of the sequence.
Performs the given action (side-effect) for each element of the sequence and passes the index of the current
element (zero-based).
Returns the zero-based index of the given element or -1 if the sequence does not contain the element.
Returns the zero-based index of the first element matching the given predicate or -1 if no element matches
the predicate.
Returns the zero-based index of the last element matching the given predicate or -1 if no element matches
the predicate.
Returns true the sequence is empty
Returns true the sequence is not empty
Joins all elements of the sequence into a string with the given configuration.
Joins all elements of the sequence into a string with the given configuration.
Returns the last element of the sequence or the last element matching predicate if present, otherwise throws
an error.
Optional predicate: ((value) => boolean | Promise<boolean>)Returns the last element of the sequence or the last element matching predicate if present, otherwise returns null.
Optional predicate: ((value) => boolean | Promise<boolean>)Transforms each element into another value by applying the given transform function and returns a new sequence.
Transforms each element into another value by applying the given transform function and returns a new sequence.
Transforms each element into another value by applying the given transform function and returns a new sequence.
Transformations into null or undefined values are discarded.
Returns the maximum element of the sequence or null if sequence is empty.
Returns the maximum element of the sequence by evaluating the given compare
function or null if sequence is empty.
Merges the elements of both sequences into a new sequence. Each element of this sequence is eventually replaced with
an element of the other sequence by comparing results of the given selector function. If no value is found in the other
sequence the element is retained. New elements of the other sequence are appended to the end of the new sequence or
prepended to the start of the new sequence, if prependNewValues is set to true. This operation is not lazy evaluated.
Returns the minimum element of the sequence or null if sequence is empty.
Returns the minimum element of the sequence by evaluating the given compare
function or null if sequence is empty.
Removes the given data and returns a new sequence. Data can either be a single element, an array of elements
or a sequence of elements.
Returns true if no element match the given predicate or if the sequence is empty
if no predicate is present.
Optional predicate: ((value) => boolean | Promise<boolean>)Performs the given action for each element and returns the sequence.
Performs the given action for each element and returns the sequence and passes the index of the current
element (zero-based).
Evaluates the given predicate for each element of the sequence and assorts each element into one of two lists
according to the result of the predicate. Returns both lists as an object.
Appends the given element to the end of the sequence and returns a new sequence.
Appends the given array to the end of the sequence and returns a new sequence.
Appends the given sequence to the end of the sequence and returns a new sequence.
Reduces the whole sequence to a single value by invoking operation with each element
from left to right. For every invocation of the operation acc is the result of the last
invocation. For the first invocation of the operation acc is the first element of the
sequence.
Reduces the whole sequence to a single value by invoking operation with each element
from left to right. For every invocation of the operation acc is the result of the last
invocation. For the first invocation of the operation acc is the first element of the
sequence. In addition the index of the current element is also passed to the operation.
Returns a new sequence with all elements of the sequence in reverse order.
Returns the single element of the sequence or throws error if the sequence has more than
one element or none at all. If a predicate is passed returns the single element matching
the predicate or throws an error if more or less than one element match the predicate.
Optional predicate: ((value) => boolean | Promise<boolean>)Returns the single element of the sequence or null if the sequence has more than
one element or none at all. If a predicate is passed returns the single element matching
the predicate or null if more or less than one element match the predicate.
Optional predicate: ((value) => boolean | Promise<boolean>)Returns a new sequence with all elements sorted by the comparator specified by the given composeComparator function
or in natural order if no arguments are given.
Optional composeComparator: ((factory) => Comparator<T>)Returns a new sequence with all elements sorted ascending by the value specified
by the given selector function.
Returns a new sequence with all elements sorted ascending by the value of the given key.
Returns a new sequence with all elements sorted descending by the value specified
by the given selector function.
Returns a new sequence with all elements sorted descending by the value of the given key.
Returns a new sequence with all elements sorted in reverse (descending) natural order.
Returns a new sequence with all elements sorted be the given compare function.
Returns the sum of all numbers.
Returns the sum of all numbers specified by the given selector function.
Returns a new sequence consisting of the first n elements. All other elements
are discarded.
Takes all elements of the sequence as long as the given predicate evaluates to true.
Returns a map consisting of each key-value pair. Pairs with null or undefined keys or values are discarded.
If a map is passed the pairs are set on this map. Duplicate keys override each other.
Optional map: Map<NonNullable<K>, NonNullable<V>>Returns a new sequence consisting of indexed values for all original elements.
Returns a new sequence consisting of pairs built the elements of both sequences with the same index. The resulting sequence has the length of the shortest input sequence. All other elements are discarded.
A Sequence provides a fluent functional API consisting of various intermediate and terminal operations for processing the iterated data. The operations are evaluated lazily to avoid examining all the input data when it's not necessary. Sequences can be iterated only once.