I want to have a predefined/fixed-size array of ArrayList but IntelliJ IDEA warns for an error.
This works:
String[] allPropsA = {prop.getProperty("xxx",""),prop.getProperty("yyy","")};
String[] allPropsB = new String[]{prop.getProperty("xxx",""),prop.getProperty("yyy","")}
public static ArrayList<String> a = new ArrayList<>();
public static ArrayList<String> b = new ArrayList<>();
ArrayList<ArrayList<String>> allListsA = new ArrayList<ArrayList<String>>();
allLists.add(a);
allLists.add(b);
But this does not work:
ArrayList<String>[] allListsB = {a,b};
It gives me an error "java: generic array creation". Why is a nested ArrayList possible, but an oldschool array not? And how can I use the accolades/fixed-size style?