The type of the values contained by this sequence.
A cached size for sequences with available size information (eg. sequences made from an sized iterable, or sequences mapped from an already sized sequence). Less than 0 for non-deterministically sized sequences, like FilteringSequences.
The underlying Iterable contained by this sequence. The values are dispatched through its iterator, so any type implementing the iterator symbol is fine.
Returns a generator yielding all values contained by this sequence.
ToString tag.
Returns a new Sequence containing the values of this sequence and the
one provided as an argument. This operation is intermediate and stateless.
The created sequence will be sized if and only if both of the concatenated sequences are of
known size. Otherwise, size information is lost.
Returns true if value
is identical to one contained by this sequence.
This is a short-circuiting terminal operation.
Returns true if all the values in values
are contained by this sequence.
This is a short-circuiting terminal operation.
If a predicate is provided, returns the amount of elements in this sequence that fulfilled it. Otherwise, returns the amount of elements in this sequence. This is a terminal operation.
Returns a new Sequence skipping the first n elements that fulfill a given predicate.
This operation is intermediate and stateful.
The sequence created is non-sized.
Returns the element at index
, or undefined if the index is out of bounds.
Since Sequences are not a Random Access collection, this operation is O(n).
This is a short-circuiting terminal operation.
Returns true if all elements in this sequence fulfill the given predicate. This is a short-circuiting terminal operation.
Returns a new Sequence keeping the elements in this sequence that fulfill the
given predicate.
This operation is intermediate and stateless.
The sequence created is non-sized.
Returns the first item fulfilling a predicate, or undefined if none does. This is a short-circuiting terminal operation.
Returns the index of the first item fulfilling a predicate, or -1 if none does. This is a short-circuiting terminal operation.
Returns the last item fulfilling a predicate, or undefined if none does. This is a terminal operation.
Returns the index of the last item fulfilling a predicate, or -1 if none does. This is a terminal operation.
Returns the first element of this sequence, or undefined if it's empty. This is a short-circuiting terminal operation and it does not hang for infinite sequences.
Returns a new Sequence flattening every sequence generated by the transformator function
by one level. This operation is intermediate and stateless.
The sequence created is non-sized.
Returns a value resulting from recursively applying an operation on an initial value and the current value for every item of this sequence. This is a terminal operation.
Performs an action on every item of this sequence. This is a terminal operation.
Groups items in this sequence into a map by a key generated by the selector provided.
All items that generate the same key (according to {@link Map.has()} equality) will end up
in the same bucket. This is a terminal operation.
Note: TinyLazySeq is opinionated about grouping algorithms and does not provide a "group to
object" equivalent (this method is equivalent to {@link Map.groupBy()}, and Sequence does not
provide an {@link Object.groupBy()} version). The library developer discourages the usage of
objects as maps, as frequent dynamic addition of keys degrades property access performance.
Returns the index of the first item of this sequence value
is identical to.
If there is none, returns -1. This is a short-circuiting terminal operation.
Returns true if this collection contains no elements. This is a short-circuiting terminal operation and it does not hang for infinite sequences.
Returns a string representation of this sequence. This is a terminal operation.
Returns the last element contained by this sequence. This is a terminal operation.
Returns the index of the last element of this sequence value
is identical to, or -1 if none is.
This is a terminal operation.
Returns a new Sequence transforming each value of this sequence.
This operation is intermediate and stateless.
The sequence created retains size information.
Returns a value resulting from recursively applying an operation on the first element of this sequence and the current value for every item of this sequence after the first. This is a terminal operation.
Returns the size of the iterable wrapped by this sequence if said iterable is a sized collection (by implementing a length or size property). Otherwise, returns a negative number.
If a predicate is provided, returns true
if at least one element of this sequence fulfills
it. Otherwise, returns true
if there is at least one element in this sequence.
This is short-circuiting terminal operation.
Returns a new Sequence dropping all elements after a predicate stops fulfilling for the
first time. This operation is intermediate and stateful.
The sequence created is non-sized.
Returns an array containing the elements of this sequence. This is a terminal operation.
Returns a string representation of this sequence and its estimated size, which could be one of the following:
Creates a lazy sequence containing no elements.
The sequence created is sized (0).
Creates a lazy sequence wrapping the provided iterable or iterator.
If an Iterable
is provided, the sequence created is sized, as long as the provided iterable
has a length
or size
property. Otherwise, size is less than 0 (unknown).
If an Iterator
is provided, the sequence created is constrained to only one iteration and
unsized, as it is impossible to know the size ahead of time.
Creates a lazy sequence whose elements are generated by the recursive application of
nextValue
on initial
until nextValue
returns null
.
The sequence created is non-sized (unknown).
Creates a lazy sequence containing the provided arguments.
The sequence created is sized (known).
Generated using TypeDoc
Describes a lazily computed sequence of elements that can be synchronously iterated over, allowing for composition of intermediate operations in an efficient, on-demand execution order.