UNPKG

@rimbu/stream

Version:

Efficient structure representing a sequence of elements, with powerful operations for TypeScript

18 lines (17 loc) 623 B
import type { OptLazy } from '@rimbu/common'; /** * An iterator that extends the default `Iterator` interface with methods that give more performance. * @typeparam T - the element type */ export interface FastIterator<T> extends Iterator<T> { /** * Returns the next iterator value, or the given `otherwise` `OptLazy` value instead. * @param otherwise - (default: undefined) the value to return if the iterator has no more values */ fastNext(): T | undefined; fastNext<O>(otherwise: OptLazy<O>): T | O; /** * Returns the next `IteratorResult`. */ next(): IteratorResult<T>; }