tee
Description:
Splits the traversable into multiple ones, caching the result if needed.
In Iterator implementation using the parent iterator is not allowed. However if any of the forked iterators Iterator.next return false then it is treated as if the parent iterator Iterator.next returned false.
The returned arrey might contain parent iterator if it is allowed by implementation. For example the iteration over collection does not need to generate and cache the results. In such case it is recommended to return the value as the first element of the array. This allows the consumer to check just the first element if it can perform optimizations for such case. However it must not depend on the order (that's for optimization only).
The resulting iterators does not need to be thread safe.
Parameters:
forks |
Number of iterators in array |
Returns:
An array with created iterators |
Since:
0.11.5