Java IntStream iterate with for each method

Description

Java IntStream iterate with for each method

import java.util.stream.IntStream;

public class Main {
  public static void main(String[] args) {
    int[] values = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0};

    IntStream intStream = IntStream.of(values);
    /* www  .j  a va  2s . c  om*/
    intStream.forEach(value -> System.out.printf("%d ", value));
    System.out.println();

  }
}



PreviousNext

Related