Please enable JavaScript.
Coggle requires JavaScript to display documents.
Understanding ArrayList (Methods (add() (method signature (boolean add(E…
Understanding ArrayList
Creating ArrayList
ArrayList list1 = new ArrayList();
ArrayList list2 = new ArrayList(10);
ArrayList list3 = new ArrayList(list2);
-
-
List<String> list6 = new ArrayList<>(); //ArrayList is a List
ArrayList<String> list7 = new List<>();//Does not compile, List is an interface
Methods
add()
method signature
boolean add(E element)
void add (int index, E element)
-
set()
E set(int index, E newElement)
-
-
-
-
-
-
Tips
adds object at indexed positions, draw it so that you won't lose track