Stream number Squares



public static void main(String[] args) {
        List<Integer> nums = Arrays.asList(1,2,3,4,5,6,7);
        List<Integer> squares = nums.stream().map(num -> num * num).collect(Collectors.toList());
        squares.forEach(System.out::println);           
    }

Output
1
4
9
16
25
36
49