As title says, was wondering if, when working with Mono/Flux, are there any equivalent (or similar) operators to peek and ifPresent from the Java Stream API.
As title says, was wondering if, when working with Mono/Flux, are there any equivalent (or similar) operators to peek and ifPresent from the Java Stream API.
Flux#hasElement:
Emit a single boolean true if any of the elements of this Flux sequence is equal to the provided value. The implementation uses short-circuit logic and completes with true if an element matches the value.
Mono<Boolean> ifPresent = Flux.<Ob>just(...)
.hasElement(value); // similar to ifPresent
Flux#doOnNext:
Add behavior (side-effect) triggered when the Flux emits an item.
Flux<Ob> flux = Flux.<Ob>just()
.doOnNext(i -> {}); // similar to peek