/** * Emit a single boolean true if any of the values of this {@link Flux} sequence match * the predicate. * <p> * The implementation uses short-circuit logic and completes with false if any value * doesn't match the predicate. * * <p> * <img class="marble" src="doc-files/marbles/any.svg" alt=""> * * @param predicate the {@link Predicate} that needs to apply to at least one emitted item * * @return a new {@link Mono} with <code>true</code> if any value satisfies a predicate and <code>false</code> * otherwise */ public final Mono<Boolean> any(Predicate<? super T> predicate) { return Mono.onAssembly(new MonoAny<>(this, predicate)); }
@Test(expected = NullPointerException.class) public void predicateNull() { new MonoAny<>(null, null); }
@Test(expected = NullPointerException.class) public void sourceNull() { new MonoAny<>(null, v -> true); }
/** * Emit a single boolean true if any of the values of this {@link Flux} sequence match * the predicate. * <p> * The implementation uses short-circuit logic and completes with false if any value * doesn't match the predicate. * * <p> * <img class="marble" src="doc-files/marbles/any.svg" alt=""> * * @param predicate the {@link Predicate} that needs to apply to at least one emitted item * * @return a new {@link Mono} with <code>true</code> if any value satisfies a predicate and <code>false</code> * otherwise */ public final Mono<Boolean> any(Predicate<? super T> predicate) { return Mono.onAssembly(new MonoAny<>(this, predicate)); }