Find numbers divisible by 5 and 6

The problem

Write a program that displays all the numbers from 100 to 1,000, ten per line, that are divisible by 5 and 6. Numbers are separated by exactly one space.

Breaking it down

Creating a range of numbers from one to a thousand and creating a Predicate that filter numbers that can be divided by 5 and 6. Next using Stream.collect will convert the stream to an arraylist. The second requirement was to display ten per line and to accomplish this we can split the ArrayList by 10 elements.

public static void main(String[] args) {

    List<Integer> div5and6 = IntStream.rangeClosed(100, 1000)
            .filter(i -> i % 5 == 0 && i % 6 == 0)
            .mapToObj(Integer::valueOf).collect(Collectors.toList());

    List<List<Integer>> splitBy10 = Lists.partition(div5and6, 10);

    for (List<Integer> list : splitBy10) {
        System.out.println(list);
    }
}

Output

[120, 150, 180, 210, 240, 270, 300, 330, 360, 390]
[420, 450, 480, 510, 540, 570, 600, 630, 660, 690]
[720, 750, 780, 810, 840, 870, 900, 930, 960, 990]