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.
forEachOrdered
has the following syntax.
void forEachOrdered(DoubleConsumer action)
The following example shows how to use forEachOrdered
.
import java.util.stream.DoubleStream; 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.