/** private key */ declare const $iterable: unique symbol; /** * A wrapper class for chaining operations such as iterable collections and infinite lists. * @template T element type. */ export declare class Iteration { /** @type {Iterable.} */ [$iterable]: Iterable; /** * @param {Iterable.} iterable Iterable object. */ constructor(iterable: Iterable); /** * Initialize this with a iterable object. * @template S element type. * @param {Iterable.} iterable Iterable object. * @returns {Iteration.} the new Iteration object. Cannot reuse. */ static on(iterable: Iterable): Iteration; /** * Check if all the elements match. * * @param {(value: T, index: number) => boolean} predicate Predicate function used to inspect elements.(index origin is Zero) * @return {boolean} Returns true if all elements meet the condition. Returns true whenever Iterable is empty. */ allMatch(predicate: (value: T, index: number) => boolean): boolean; /** * Check if any of the elements match. * * @param {(value: T, index: number) => boolean} predicate Predicate function used to inspect elements.(index origin is Zero) * @return {boolean} Returns true if either element meets the conditions. Returns false whenever Iterable is empty. */ anyMatch(predicate: (value: T, index: number) => boolean): boolean; /** * Concatenate iterable objects. * @param {Iterable.>} subsequents Iterable objects. * @returns {Iteration.} The new Iteration. Cannot reuse. */ concat(...subsequents: Array>): Iteration; /** * Discards the element while the condition is met. And it returns the rest. * @param {(value: T, index: number) => boolean} predicate Predicate to determine whether to discard the value.(index origin is Zero) * @returns {Iteration.} The new Iteration. Cannot reuse. */ dropWhile(predicate: (value: T, index: number) => boolean): Iteration; /** * Returns only the elements that satisfy the condition. * @param {(value: T, index: number) => boolean} predicate A predicate that determines if a value is legal.(index origin is Zero) * @returns {Iteration.} The new Iteration. Cannot reuse. */ filter(predicate: (value: T, index: number) => boolean): Iteration; /** * Returns the first element that matches the condition. * @param {undefined | ((value: T, index: number) => boolean)} predicate If omit the condition, always true.(index origin is Zero) * @return {?T} The first element that satisfies the condition. Null if not found. */ findFirst(predicate?: (value: T, index: number) => boolean): T | null; /** * Maps the element to another type and flat. * * @template U another type * @param {Iterable.} iterable Iterable object. * @param {(value: T, index: number) => Iterable.} mapper Transformer function.(index origin is Zero) * @returns {Iteration.} The new Iteration. Cannot reuse. */ flatMap(mapper: (value: T, index: number) => Iterable): Iteration; /** * Perform the iteration. * @param {(value: T, index: number) => void} consumer Consumer function. (index origin is Zero) * @returns {void} Nothing. */ forEach(consumer: (value: T, index: number) => void): void; /** * Limit the number of elements. * @param {number} maxSize Maximum number of elements. * @returns {Iteration.} The new Iteration. Cannot reuse. */ limit(maxSize: number): Iteration; /** * Maps the element to another type. * @template U another type. * @param {(value: T, index: number) => S} mapper Transformer function.(index origin is Zero) * @returns {Iteration.} The new Iteration. Cannot reuse. */ map(mapper: (value: T, index: number) => U): Iteration; /** * Apply the consumption function to the element. * * This is intended for logging during debugging, for example. * @param {(value: T, index: number) => void} consumer Consumer function. (index origin is Zero) * @returns {Iteration.} The new Iteration. Cannot reuse. */ peek(consumer: (value: T, index: number) => void): Iteration; /** * Performs a reduction on the elements of a iterable object using the initial value, * cumulative, and associative functions. * @template U result type. * @param {(result: U | null, element: T, index: number) => U} accumulator A function that transforms and calculates the result.(index origin is Zero) * @param {?U} initial Initial value. * @returns {U | null} Result value. */ reduce(accumulator: (result: U | null, element: T, index: number) => U, initial?: U | null): U | null; /** * Remove n elements from the beginning. * @param {number} n The number of elements to skip from the beginning. * @returns {Iteration.} The new Iteration. Cannot reuse. */ skip(n: number): Iteration; /** * Returns the elements until the condition is no longer met. Discard the rest. * @param {(value: T, index: number) => boolean} predicate A predicate that determines whether the value is still returned.(index origin is Zero) * @returns {Iteration.} The new Iteration. Cannot reuse. */ takeWhile(predicate: (value: T, index: number) => boolean): Iteration; /** * Convert to an Iterable object. * @returns {Iterable} The new Iterable. Cannot reuse. */ toIterable(): Iterable; /** * Convert to an Iterator object. * @returns {Iterator} The new Iterator. Cannot reuse. */ toIterator(): Iterator; /** * Combines each element of a iterable object. * * The first element of the array is the value of the first Iterable object. * The second element is the value of the second Iterable object. * * If one is shorter than the other, the return length is equal to that length. * @param {Iterable.} another Iterable object. * @returns {Iteration.>} The new Iteration. Cannot reuse. */ zip(another: Iterable): Iteration>; [Symbol.iterator](): Iterable; } export default Iteration;