Java IntStream map element to new value

Description

Java IntStream map element to new value

import java.util.stream.IntStream;

public class Main {
  public static void main(String[] argv) {
    int[] values = {1,2,3,4,5,6,7,8,9,0};
    /*from  w  w  w  .j  a  v a  2  s. co  m*/
    IntStream.of(values)
             .filter(value -> value % 2 != 0)
             .map(value -> value * 10)
             .sorted()
             .forEach(value -> System.out.printf("%d ", value));
  }
}



PreviousNext

Related