ListStream

class ListStream<T>(list: List<T>) : Stream<T> (source)

Create a stream from a list The stream internally uses the list's iterator (because, depending on the list's implementation, there might be performance gains over using the list's get method)

Return

The created stream

Since

0.5.0

Parameters

list

The list to create the stream from

Constructors

Link copied to clipboard
constructor(list: List<T>)

Functions

Link copied to clipboard
fun <T> Stream<out Stream<T>>.flatten(): FlatStream<T>
Link copied to clipboard
open fun forEach(action: (T) -> Unit)

For each element in the stream, call the given function

Link copied to clipboard
open fun forEachIndexed(action: (Int, T) -> Unit)

For each element in the stream, call the given function

Link copied to clipboard
open override fun hasNext(): Boolean

Check if the stream has a next element

Link copied to clipboard
open fun <R> map(mapper: (T) -> R): Stream<R>

Map the stream to another stream

Link copied to clipboard
open fun <R> mapIndexed(mapper: (Int, T) -> R): Stream<R>

Map the stream to another stream

Link copied to clipboard
open override fun read(): T

Read the next element from the stream