class Consumable<T>
(source)
A generic wrapper for values that can get consumed.
fun consume(consumer: (value: T) -> Boolean): Boolean
Invokes the given lambda and marks the value as consumed if the lambda returns true. |
|
fun consumeBy(consumers: List<(T) -> Boolean>): Boolean
Invokes the given list of lambdas and marks the value as consumed if at least one lambda returned true. |
|
fun isConsumed(): Boolean
Returns whether the value was consumed. |
fun <T> empty(): Consumable<T>
Returns an empty Consumable with not value as if it was consumed already. |
|
fun <T> from(value: T): Consumable<T>
Create a new Consumable wrapping the given value. |