filter

fun <T> Stream<T>.filter(predicate: (T) -> Boolean): Stream<T?>

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


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.

The initial value is published as long as only null values are published by the stream.