This terminal-short-circuiting operation returns whether all elements match the provided predicate criteria. It returns 'false' on finding the first mismatch hence short-circuiting the operation.
If the stream is empty then this method returns true and the predicate is not evaluated.
Examples
package com.logicbig.example.longstream;
import java.util.stream.LongStream;
public class AllMatchExample {
public static void main(String... args) { LongStream stream = LongStream.of(3, 6, 9); boolean b = stream.allMatch(AllMatchExample::odd); System.out.println(b);