Stream noneMatch(Predicate<? super T> predicate)
tells whether
no elements of this stream match the provided predicate.
noneMatch
has the following syntax.
boolean noneMatch(Predicate<? super T> predicate)
The following example shows how to use noneMatch
.
import java.util.Arrays; import java.util.List; //w ww . j a v a2 s . c om public class Main { public static void main(String[] args) { List<Integer> numbers = Arrays.asList(1, 2, 3, 4, 5); boolean o = numbers.stream() .noneMatch(n-> n % 2 ==0); System.out.println(o); } }
The code above generates the following result.