Come ricordo, prima di Java 8, la capacità predefinita di ArrayListera 10.
Sorprendentemente, il commento sul costruttore predefinito (void) dice ancora: Constructs an empty list with an initial capacity of ten.
Da ArrayList.java:
/**
* Shared empty array instance used for default sized empty instances. We
* distinguish this from EMPTY_ELEMENTDATA to know how much to inflate when
* first element is added.
*/
private static final Object[] DEFAULTCAPACITY_EMPTY_ELEMENTDATA = {};
...
/**
* Constructs an empty list with an initial capacity of ten.
*/
public ArrayList() {
this.elementData = DEFAULTCAPACITY_EMPTY_ELEMENTDATA;
}
