I am reading the Drools Planner examples and I came across code like this a lot:
List<Column> columnList = new ArrayList<Column>(n);
As far as I get it, it is supposed to initialize a list of length n which stores the Column
datatype.
But what is the deal with having different collection datatypes on either side of the expression?
If ArrayList<Column>
type-matches with List<Column>
, what makes it different from doing:
List<Column> columnList = new List<Column>(n);