:
.
. , ;
= 2
Arraylist:
:
List<String> list = new ArrayList<>();
System.out.println(l.size());
: 0
?
, , ArrayList, :
private static final Object[] EMPTY_ELEMENTDATA = {};
, , 0 (). , 0.
(id of elementData = 27)
, 1, 10 (); (id of elementData = 30)
private static final int DEFAULT_CAPACITY = 10
(id of elementData = 30)
ArrayList, API java :
API Java: https://docs.oracle.com/javase/7/docs/api/java/util/ArrayList.html#ArrayList%28%29
public ArrayList()
Constructs an empty list with an initial capacity of ten.
, ( 0) . ( 10)
, . ? add (E element)
O (1), ( ), O (n) ( ), , , ( 1,5 ), . , .
, 0 . , , .
, ArrayList :
Core Java 2:
ArrayList < 'Employee > (100)// 100
- , Employee [100]// 100
. 100 , 100 , . 100 100 (, , 100, ); , build, .