Package-level declarations
Sequence type that represents lazily evaluated collections. Top-level functions for instantiating sequences and extension functions for sequences.
Classification of sequences
The sequence operations can be classified into the following groups regarding their state requirements:
stateless – operations which require no state and process each element independently like kotlin.sequences.Sequence.map, kotlin.sequences.Sequence.filter, or require a small constant amount of state to process an element, for example kotlin.sequences.Sequence.take or kotlin.sequences.Sequence.drop;
stateful – operations which require a significant amount of state, usually proportional to the number of elements in a sequence.
If the sequence operation returns another sequence, which is produced lazily, it's called intermediate, and otherwise the operation is terminal. Examples of terminal operations are kotlin.sequences.Sequence.toList, kotlin.sequences.Sequence.max.
Sequences can be iterated multiple times, however some sequence implementations might constrain themselves to be iterated only once. That is mentioned specifically in their documentation (e.g. kotlin.sequences.generateSequence overload). The latter sequences throw an exception on an attempt to iterate them the second time.
Functions
Creates a sequence that returns all values from this enumeration. The sequence is constrained to be iterated only once.
Returns a sequence containing all elements that are instances of specified class.
Appends all elements that are instances of specified class to the given destination.
Returns a new SortedSet of all elements.