Java Stream anyMatch() Example

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

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

Java Stream anyMatch() Example

Here is a Java Stream anyMatch() 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 anyMatch = stream.anyMatch((value) -> { return value.startsWith("Java"); });




Java Stream Methods/APIs Examples