add element arraylist java code example
Example 1: java insert into arraylist
ArrayList<Integer> str=new ArrayList<Integer>();
str.add(0);
str.add(1);
str.add(1, 11);
Example 2: insert element into arraylist java
ArrayList<String> arrayList = new ArrayList<>();
arrayList.add("foo");
arrayList.add("bar");
arrayList.add(1, "baz");
Example 3: java arraylist add
ArrayList<String> arrayList = new ArrayList<String>();
arrayList.add("item");
System.out.println(arrayList.contains("item"));
arrayList.remove("item");