StreamWrapperBase

abstract class StreamWrapperBase<WRAPPED, RESULT>(wrapped: Stream<WRAPPED>) : Stream<RESULT>

Base class for all stream wrappers

Inheritors

Constructors

Link copied to clipboard
constructor(wrapped: Stream<WRAPPED>)

Functions

Link copied to clipboard
fun <T> Stream<T>.asFlow(): Flow<T>

Converts the Stream into a Flow

Link copied to clipboard
fun <IN1, IN2, OUT> Stream<IN1>.combinedWith(other: Stream<IN2>, combinator: (IN1, IN2) -> OUT): Stream<OUT>

Combines with the other stream.

Link copied to clipboard
fun <T> Stream<T>.debounce(delayMs: Int, delayFirstMs: Int = 3): Stream<T>

Debounce the incoming values by the given delayMs

Link copied to clipboard
fun <T> Stream<T>.distinct(): Stream<T>
fun <T> Stream<T>.distinct(strict: Boolean = false): Stream<T>

Ignores duplicate values and thus only publishes when the value has changed.

Link copied to clipboard

Ignores duplicate values and thus only publishes when the value has changed.

Link copied to clipboard
fun <T> Stream<T?>.fallbackBy(fallback: () -> T): Stream<T>

Published the value produced by fallback whenever the value on the stream is null.

Link copied to clipboard
fun <T> Stream<T?>.fallbackTo(fallback: T): Stream<T>

Published the fallback whenever the value on the stream is null.

Link copied to clipboard
fun <T> Stream<T>.filter(predicate: (T) -> Boolean): Stream<T?>
fun <T> Stream<T>.filter(initial: T, predicate: (T) -> Boolean): Stream<T>

Filter the incoming values and publish only the ones that match the predicate.

Link copied to clipboard
inline fun <T, I : T> Stream<T?>.filterIsInstance(): Stream<I?>
inline fun <T, I : T> Stream<T?>.filterIsInstance(initial: I): Stream<I>

Filters the incoming values and publish only the ones that are an instance of I.

Link copied to clipboard
fun <T> Stream<T?>.filterNotNull(initial: T): Stream<T>

Filter out all null values.

Link copied to clipboard
fun <T, R> Stream<T>.fold(initial: R, operation: (acc: R, next: T) -> R): Stream<R>

Folds the incoming values with the operation starting with the initial value.

Link copied to clipboard
fun <T, R> Stream<T?>.foldNotNull(initial: R, operation: (acc: R, next: T) -> R): Stream<R>
Link copied to clipboard
fun <T> Stream<T>.history(capacity: Int): Stream<List<T>>

Records the latest incoming values up to the given capacity.

Link copied to clipboard
fun <T> Stream<T?>.historyOfNonNull(capacity: Int): Stream<List<T>>

Records the latest incoming values that are not null up to the given capacity.

Link copied to clipboard
fun <T> Stream<T>.indexed(): Stream<Pair<Int, T>>

Map the stream to pairs of index to value.

Link copied to clipboard
abstract operator fun invoke(): RESULT

Returns the current value of the stream

Link copied to clipboard
fun <IN, OUT> Stream<IN>.map(mapper: (IN) -> OUT): Stream<OUT>

Maps incoming values from type IN to type OUT.

Link copied to clipboard
fun <IN, OUT> Stream<IN>.mapAsync(mapper: suspend (IN) -> OUT?): Stream<OUT?>

Maps incoming values asynchronously from type IN to type OUT.

Link copied to clipboard
fun <T> Stream<T>.onEach(block: (T) -> Unit): Stream<T>
Link copied to clipboard

Pairs the stream with the other stream.

Link copied to clipboard
fun <T> Stream<T>.permanent(): Stream<T>
fun <T> Stream<T>.permanent(handler: (T) -> Unit): Stream<T>

Subscribes to the stream permanently

Link copied to clipboard

Adds a subscription to the stream.