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.intstream;
import java.util.stream.IntStream;
public class AllMatchExample {
public static void main(String... args) { IntStream intStream = IntStream.of(1, 2, 3, 2, 5, 4); boolean b = intStream.allMatch(AllMatchExample::greaterThanZero); System.out.println(b);