android-components / mozilla.components.support.base.observer / Consumable

# Consumable

`class Consumable<T>` (source)

A generic wrapper for values that can get consumed.

### Functions

consume | `fun consume(consumer: (value: T) -> Boolean): Boolean` Invokes the given lambda and marks the value as consumed if the lambda returns true.
consumeBy | `fun consumeBy(consumers: List<(T) -> Boolean>): Boolean` Invokes the given list of lambdas and marks the value as consumed if at least one lambda returns true.
isConsumed | `fun isConsumed(): Boolean` Returns whether the value was consumed.

### Companion Object Functions

empty | `fun <T> empty(): Consumable<T>` Returns an empty Consumable with not value as if it was consumed already.
from | `fun <T> from(value: T): Consumable<T>` Creates a new Consumable wrapping the given value.
stream | `fun <T> stream(vararg values: T): ConsumableStream<T>` Creates a new Consumable stream for the provided values.