Java Streams - DoubleStream concat(DoubleStream a, DoubleStream b) example








DoubleStream concat(DoubleStream a, DoubleStream b) concatenates streams.

Syntax

concat has the following syntax.

static DoubleStream concat(DoubleStream a,   DoubleStream b)

Example

The following example shows how to use concat.

import java.util.stream.DoubleStream;
import java.util.stream.Stream;
/* w  w w  . java  2 s  . c om*/
public class Main {
  public static void main(String[] args) {
    DoubleStream i = DoubleStream.concat(DoubleStream.of(1.0,2.0,3.3),DoubleStream.of(4.4,5.5,6.6,7.7));
    Stream<Double> o =  i.boxed();
    
    o.forEach(System.out::println);
  }
}

The code above generates the following result.