Java IntStream map int to square value
import java.util.stream.IntStream; public class Main { public static void main(String[] args) { IntStream.rangeClosed(1, 5)// w w w . jav a 2 s.c o m .map(n -> n * n) .forEach(System.out::println); } }