Close

Java 8 Streams - DoubleStream.noneMatch Examples

Java 8 Streams Java Java API 


Interface:

java.util.stream.DoubleStream

java.lang.AutoCloseableAutoCloseablejava.util.stream.BaseStreamBaseStreamjava.util.stream.DoubleStreamDoubleStreamLogicBig

Method:

boolean noneMatch(DoublePredicate predicate)

This terminal operation returns whether no elements of this stream match the provided predicate. It may not evaluate the predicate on all elements if not necessary for determining the result, hence, it is a short circuiting operation. If the stream is empty then true is returned and the predicate is not evaluated.

Examples


package com.logicbig.example.doublestream;

import java.util.stream.DoubleStream;

public class NoneMatchExample {

public static void main(String... args) {
DoubleStream ds = DoubleStream.of(1.0, 1.2, 2.0, 2.4, 3.0);
boolean b = ds.noneMatch(d -> d == 2.5);
System.out.println(b);
}
}

Output

true




package com.logicbig.example.doublestream;

import java.util.stream.DoubleStream;

public class NoneMatchExample2 {

public static void main(String... args) {
boolean b = DoubleStream.empty()
.noneMatch(d -> false);
System.out.println(b);
}
}

Output

true




See Also