Sequence
Produces elements on demand through an iterator, without storing a collection of results.
Each traversal asks iterator for its own state. Repeatability and mutation behavior follow the source. Iterators, wrappers and captured callbacks use ordinary managed heap quotas.
Type Parameters
element type, including nullable types.
Functions
Checks availability without reading an element; returns false when empty.
Stops at the first match; returns false when empty without invoking predicate. Exceptions propagate; the immediate inline callback admits non-local returns.
Consumes all elements and returns their count, including null elements.
Counts matches in iteration order, consuming the entire sequence. Exceptions propagate; the immediate inline callback admits non-local returns.
Retains matching elements in source order, testing only as far as the consumer requests. hasNext may advance the source and invoke the retained predicate. Repeated hasNext calls reuse a cached element, including null. Each traversal has its own cache.
Lazily skips null elements and exposes a non-null element type. Searches only as far as the consumer requests; repeated hasNext calls reuse the cache. Primitive accepted values use the existing scalar cache; reference slots clear on consumption.
Returns the first element, including null, or null when empty. Stops after that element.
Returns the first matching element, including null, or null when none matches. Stops immediately at a match. The immediate inline predicate admits non-local returns.
Transforms elements when the returned iterator's next is called. The callback is retained and may run again on subsequent traversals; exceptions propagate. No intermediate list is created. Unlike eager inline map, non-local returns are unavailable.
Transforms elements on demand and skips null results, preserving source order. Repeated hasNext calls reuse the accepted result without invoking transform again. The callback is retained; exceptions propagate and non-local returns are unavailable. Nullable primitive results use their ordinary boxes before non-null scalar caching.
Checks availability without reading an element; returns true when empty.
Stops at the first match; returns true when empty without invoking predicate. Exceptions propagate; the immediate inline callback admits non-local returns.