/** * Returns an {@link OptionalInt} describing some element of the stream, * which matches given predicate, or an empty {@code OptionalInt} if there's * no matching element. * * <p> * This is a short-circuiting terminal operation. * * <p> * The behavior of this operation is explicitly nondeterministic; it is free * to select any element in the stream. This is to allow for maximal * performance in parallel operations; the cost is that multiple invocations * on the same source may not return the same result. (If a stable result is * desired, use {@link #findFirst(IntPredicate)} instead.) * * @param predicate a * <a href="package-summary.html#NonInterference">non-interfering * </a>, <a href="package-summary.html#Statelessness">stateless</a> * predicate which returned value should match * @return an {@code OptionalInt} describing some matching element of this * stream, or an empty {@code OptionalInt} if there's no matching * element * @see #findAny() * @see #findFirst(IntPredicate) */ public OptionalInt findAny(IntPredicate predicate) { return filter(predicate).findAny(); }