This is a terminal-short-circuiting operation. It checks whether any elements of this LongStream match the provided LongPredicate. It will terminate (short-circuiting) with a result of 'true' when the very first element matches the provided predicate.
If the stream is empty then false is returned and the predicate is not evaluated.
Examples
package com.logicbig.example.longstream;
import java.util.stream.LongStream;
public class AnyMatchExample {
public static void main(String... args) { LongStream stream = LongStream.of(3, 6, 12); boolean b = stream.anyMatch(AnyMatchExample::odd); System.out.println(b);