DoubleStream filter(DoublePredicate predicate)
returns
a stream that matches the given predicate.
This is an intermediate operation.
filter
has the following syntax.
DoubleStream filter(DoublePredicate predicate)
The following example shows how to use filter
.
import java.util.stream.DoubleStream; //w w w.ja v a 2s .c o m public class Main { public static void main(String[] args) { DoubleStream d = DoubleStream.of(1.2,2.3,4.5); d.filter(n -> n<3) .forEach(System.out::println); } }
The code above generates the following result.