Java Stream allMatch() Example

In this tutorial, we will learn Java 8 Stream allMatch() terminal operation with an example.

The Java Stream allMatch() method is a terminal operation that takes a single Predicate as the parameter, starts the internal iteration of elements in the Stream, and applies the Predicate parameter to each element.

If the Predicate returns true for all elements in the Stream, the allMatch() will return true. If not all elements match the Predicate, the allMatch() method returns false.

Java Stream allMatch() Example

Here is a Java Stream allMatch() example:

import java.util.ArrayList;
import java.util.List;

public class Main {
    public static void main(String[] args)
        List<String> stringList = new ArrayList<String>();

        stringList.add("Java Guides");
        stringList.add("Python Guides");
        stringList.add("C Guides");

        Stream<String> stream =;

        boolean allMatch = stream.allMatch((value) -> { return value.contains("Guides"); });




Java Stream Methods/APIs Examples