IntStream builder() example

Description

IntStream builder() returns a builder for an IntStream.

Syntax

builder has the following syntax.


static IntStream.Builder builder()

Example

The following example shows how to use builder.


import java.util.stream.IntStream;
//  w ww  .j ava2s .  co  m
public class Main {
  public static void main(String[] args) {
    IntStream i = IntStream.builder().add(0).build();
    i.forEach(System.out::println);  
  }
}

The code above generates the following result.





















Home »
  Java Streams »
    Reference »




Collectors
DoubleStream
DoubleStream.Builder
IntStream
IntStream.Builder
LongStream
LongStream.Builder
Stream
Stream.Builder