If you need to flatten list of lists into array you can try something like that:
public static void main(String [] args) {
List<List<Integer>> integers = Lists.newArrayList(
Lists.newArrayList(1, 2, 3, 4),
Lists.newArrayList(5, 3, 6, 7)
);
Integer[] flattened = integers.stream()
.flatMap(Collection::stream)
.toArray(Integer[]::new);
checkCategories(flattened);
}
public static void checkCategories(Integer... indices) {
for (Integer i : indices) {
System.out.println(i);
}
}
It prints:
1
2
3
4
5
3
6
7