Function tee

  • Returns n independent iterators, each of which is a copy of the input iterator at the time of calling tee. Once tee has made a split, do not modify or call upon the original iterator, as the new iterators will not be updated/informed. This caches the original iterator's values as the new iterators are iterated through. So depending on the size of the original iterator, there could be significant memory overhead in using tee. tee's intended use is to iterate over the returned iterators in parallel, or at least somewhat in parallel. In general, if one returned iterator consumes most or all of it's values, then it is faster to just use toArray and then iterate over that.

    Type Parameters

    Parameters

    • arg: T
    • n: N

      The number of independent iterators to create.

    Returns Tuple<IterableIterator<IterSource<T>>, N>

  • Type Parameters

    Parameters

    Returns ((arg: T) => Tuple<IterableIterator<IterSource<T>>, N>)