Java Streams - IntStream noneMatch(IntPredicate predicate) example








IntStream noneMatch(IntPredicate predicate) returns whether no elements of this stream match the provided predicate.

Syntax

noneMatch has the following syntax.

boolean noneMatch(IntPredicate predicate)

Example

The following example shows how to use noneMatch.

import java.util.stream.IntStream;

public class Main {
  public static void main(String[] args) {
    IntStream i = IntStream.of(6,5,7,1, 2, 3, 3);
    boolean d = i.noneMatch(n-> n > 0 );
    System.out.println(d);
  }
}

The code above generates the following result.