Sequence Operations

Gatherers that reorder, combine, or manipulate the sequence of elements.

Gatherers

FunctionDescription
crossWith()Cross every element of the input stream with every element of the given source, emitting them to the output stream as a Pair<INPUT, CROSS>.
foldIndexed()Perform a fold over every element in the input stream along with its index
interleaveWith()Creates a stream of alternating objects from the input stream and the argument source
orderByFrequency()Emit elements in the input stream ordered by the specified frequency.
repeat()Repeatedly emit the input stream to the output stream a given number of times.
repeatInfinitely()Repeatedly emit the input stream to the output stream, infinitely.
reverse()everse the order of the input stream.
rotate()Consume the entire stream and emit its elements rotated either left or right distance number of spaces
scanIndexed()Perform a scan over every element in the input stream along with its index
shuffle()Shuffle the input stream into a random order.
throttle()Limit the number of elements in the stream to some number per period. When the limit is reached consumption is paused until a new period starts and the count resets.
withIndex()Maps all elements of the stream as-is along with their 0-based index.
zipWith()Creates a stream of Pair<FIRST,SECOND> objects whose values come from the input stream and the source of arguments provided
zipWithNext()Creates a stream of List objects which contain each two adjacent elements in the input stream.