java array of arraylists
You have to keep a list of lists of JButton objects:
List<List<JButton>> lists = new ArrayList<List<JButton>>();
// populate (replace with your code)
lists.add(Arrays.asList(new JButton("list 1, button 1"), new JButton("list 1, button 2")));
lists.add(Arrays.asList(new JButton("list 2, button 3"), new JButton("list 2, button 4")));
lists.add(Arrays.asList(new JButton("list 3, button 5"), new JButton("list 3, button 6")));
lists.add(Arrays.asList(new JButton("list 4, button 7"), new JButton("list 4, button 8")));
// iterate
for(List<JButton> subList : lists) {
for(JButton button : subList) {
System.out.println(button.getText());
}
}
Giving an example of what worked for me / talked above.
List []oArrayOfArrayList = new ArrayList[2];
List<String> oStringList = new ArrayList<String>();
List<Integer> oIntegerList = new ArrayList<Integer>();
oArrayOfArrayList[0] = oStringList ;
oArrayOfArrayList[1] = oIntegerList ;
You cannot create arrays from classes with generic parameters.
You'll either want to make a list of a list, or forgo generic parameters.