Java Streams - DoubleStream spliterator() example








DoubleStream spliterator() returns spliterator for DoubleStream.

Syntax

spliterator has the following syntax.

Spliterator.OfDouble spliterator()

Example

The following example shows how to use spliterator.

import java.util.Spliterator;
import java.util.stream.DoubleStream;
//from www .java2s.c o  m
public class Main {
  public static void main(String[] args) {
    DoubleStream b = DoubleStream.of(1.1,2.2,3.3,4.4,5.5);
    Spliterator.OfDouble o = b.spliterator();
    System.out.println(o.characteristics());
  }
}

The code above generates the following result.