| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 
 |     @Testpublic void test2(){
 ArrayList<Object> list = new ArrayList<>();
 list.add(123);
 list.add(456);
 list.add(new String("Tom"));
 list.add(false);
 list.add(new Person("Jerry",12));
 System.out.println(list);
 
 
 list.add(1,"BB");
 System.out.println(list);
 
 
 List<Integer> integers = Arrays.asList(1, 2, 3);
 list.addAll( integers);
 System.out.println(list.size());
 
 
 System.out.println(list.get(1));
 
 
 System.out.println(list.indexOf(456));
 
 
 list.remove(1);
 System.out.println(list);
 
 
 list.set(1,"CC");
 System.out.println(list);
 
 
 System.out.println(list.subList(1,3));
 
 
 
 Iterator<Object> iterator = list.iterator();
 while (iterator.hasNext()){
 System.out.println(iterator.next());
 }
 
 
 for (Object o: list){
 System.out.println(o);
 }
 }
 
 }
 
 |