This intermediate operation returns an equivalent stream that is sequential. May return itself, either because the stream was already sequential, or because the underlying stream state was modified to be sequential.
Examples
package com.logicbig.example.doublestream;
import java.util.stream.DoubleStream;
public class SequentialExample {
public static void main(String... args) {
System.out.println("-- sequential --"); DoubleStream ds2 = DoubleStream.of(1.0, 1.2, 2.0, 2.4, 3.0); ds2.sequential()//redundant as stream was already sequential by default .forEach(System.out::println);