cached

Returns a cached (memorized) version of this sequence.

The elements are cached on first access and subsequent iterations reuse the cached values.

It's permitted to create two different iterators (via KoneSequence.iterator) and use them at the same time. But be sure to use the same thread safety semantic on them (i.e. with KoneSequenceCacheThreadSafetyMode.NONE you should not call the iterators' methods concurrently).

Return

A cached KoneSequence instance.

Parameters

mode

The thread-safety mode for the cached sequence.

Type Parameters

Element

The type of elements.