Find operator

Rocket.findFunction
find(conditionFn::F) where { F <: Function }

Creates a find operator, which emits only the first value emitted by the source Observable that meets some condition.

Producing

Stream of type <: Subscribable{L} where L refers to type of source stream

Arguments

  • conditionFn::F: condition function with (data::T) -> Bool signature

Examples

using Rocket

source = from([ 1, 2, 3, 4, 5, 6, 7, 8 ])
subscribe!(source |> find((d) -> d % 2 == 0), logger())
;

# output

[LogActor] Data: 2
[LogActor] Completed

See also: AbstractOperator, InferableOperator, ProxyObservable, logger

source

Description

find searches for the first item in the source Observable that matches the specified condition embodied by the predicate, and returns the first occurrence in the source. Does not emit an error if a valid value is not found.

See also

Operators, take