I am writing a board game, and I defined my own linked Node class(to implement the order of positions).
There are 17 positions, and among them are three distinct special positions.
I want to implement this positions with ArrayList with "BLACK"s and "WHITE"s.
Since where the special positions are will be decided randomly for every game, I am considering using
private ArrayList<ArrayList<String>> _al = new ArrayList<ArrayList<String>>(18);
so that I could shuffle the special positions
Collections.shuffle(_al);
HNode<ArrayList<String> _l1 = new HNode<ArrayList<String>>(_al.get(0), null, _l2);
HNode<ArrayList<String> _l2 = new HNode<ArrayList<String>>(_al.get(1), _l1, _l3);
and so on. (HNode's constructor's parameters are (data, prev, next))
My questions are,
Would the following line automatically create 18 ArrayLists of String objects? Or should I (and could I) create them first and add them to _al?
private ArrayList<ArrayList<String>> _al = new ArrayList<ArrayList<String>>(18);
Thank you.