Java Streams - IntStream spliterator() example








IntStream spliterator() returns the Spliterator for IntStream.

Syntax

spliterator has the following syntax.

Spliterator.OfInt spliterator()

Example

The following example shows how to use spliterator.

import java.util.Spliterator;
import java.util.stream.IntStream;
/*from  w w  w  .  ja  va 2  s  .  c o m*/
public class Main {
  public static void main(String[] args) {
    IntStream i = IntStream.of(1,2,3,4,5,6,7);
    Spliterator.OfInt o =  i.spliterator();
    System.out.println(o.characteristics());  
  }
}

The code above generates the following result.