1import java.util.Arrays.*;
2
3List<List<T>> items = new ArrayList<>(Arrays.asList(
4 Arrays.asList(T ...items),
5 Arrays.asList(T ...items1),
6 Arrays.asList(T ...items2)
7));
8
9
10//for string type :
11List<List<String>> items = new ArrayList<>(Arrays.asList(
12 Arrays.asList("a", "b", "c"),
13 Arrays.asList("d", "e", "f"),
14 Arrays.asList("g", "h", "i")
15));
16
17System.out.println("Output : " + items.toString());
18//Output : [ [a, b, c], [d, e, f], [g, h, i] ]
19
20//Another answer from stackoverflow suggests a way without using built-in as:List method
21// Link : https://stackoverflow.com/a/6233024