class ConsumableStream<T>
(source)
A generic wrapper for a stream of values that can be consumed. Values will be consumed first in, first out.
fun append(vararg values: T): ConsumableStream<T>
Copies the stream and appends the provided values. |
|
fun consumeAll(consumer: (value: T) -> Boolean): Boolean
Invokes the given lambda for each consumable value and marks the values as consumed if the lambda returns true. |
|
fun consumeAllBy(consumers: List<(T) -> Boolean>): Boolean
Invokes the given list of lambdas for each consumable value and marks the values as consumed if at least one lambda returns true. |
|
fun consumeNext(consumer: (value: T) -> Boolean): Boolean
Invokes the given lambda with the next consumable value and marks the value as consumed if the lambda returns true. |
|
fun consumeNextBy(consumers: List<(T) -> Boolean>): Boolean
Invokes the given list of lambdas with the next consumable value and marks the value as consumed if at least one lambda returns true. |
|
fun isConsumed(): Boolean
Returns true if all values in this stream were consumed, otherwise false. |
|
fun isEmpty(): Boolean
Returns true if the stream is empty, otherwise false. |
|
fun remove(value: T): ConsumableStream<T>
Copies the stream but removes all consumables equal to the provided value. |
|
fun removeConsumed(): ConsumableStream<T>
Copies the stream but removes all consumed values. |