DoubleStream forEachOrdered(DoubleConsumer action) example
Description
DoubleStream forEachOrdered(DoubleConsumer action)
performs an action for each element of this stream,
guaranteeing that each element is processed in encounter order.
This is a terminal operation.
Syntax
forEachOrdered
has the following syntax.
void forEachOrdered(DoubleConsumer action)
Example
The following example shows how to use forEachOrdered
.
import java.util.stream.DoubleStream;
/*from www . j a v a2 s .c o m*/
public class Main {
public static void main(String[] args) {
DoubleStream d = DoubleStream.of(1.2,2.3,4.5);
d.forEachOrdered(System.out::println);
}
}
The code above generates the following result.