List of usage examples for java.util ArrayList ArrayList
public ArrayList()
From source file:MainClass.java
public static void main(String args[]) throws Exception { List list = new ArrayList(); list.add("A"); list.add("B"); list.add("C"); list.add(1, "G"); System.out.println(list);//from w w w . ja v a 2 s .co m }
From source file:Main.java
public static void main(String args[]) throws Exception { List<String> list = new ArrayList<String>(); list.add("A"); list.add("B"); list.add("C"); list.clear();/*w ww .ja va 2 s .com*/ System.out.println(list); }
From source file:Main.java
public static void main(String args[]) throws Exception { List<String> list = new ArrayList<String>(); list.add("A"); list.add("B"); list.add("C"); System.out.println(list.get(2)); }
From source file:Main.java
public static void main(String[] args) { List<String> carList = new ArrayList<String>(); carList.add("A"); carList.add("B"); carList.add("C"); carList.add("D"); String[] carArray = carList.toArray(new String[0]); for (String car : carArray) { System.out.println(car);// www . j a v a 2 s .co m } }
From source file:MainClass.java
public static void main(String[] a) { ArrayList<String> nums = new ArrayList<String>(); nums.add("O"); nums.add("Two"); nums.add("Three"); nums.add("Four"); String s;//from w w w . j a v a 2 s.c o m Iterator e = nums.iterator(); while (e.hasNext()) { s = (String) e.next(); System.out.println(s); } }
From source file:MainClass.java
public static void main(String args[]) throws Exception { List list = new ArrayList(); list.add("A"); list.add("B"); list.add("C"); System.out.println(list.remove(0)); System.out.println(list.remove("B")); System.out.println(list);// w ww. ja v a2s . c o m }
From source file:Main.java
public static void main(String[] args) { ArrayList<String> aList = new ArrayList<String>(); aList.add("1"); aList.add("2"); aList.add("3"); aList.add("4"); aList.add("5"); ListIterator listIterator = aList.listIterator(); while (listIterator.hasNext()) { System.out.println(listIterator.next()); }//w w w . j a v a 2 s . c om }
From source file:Main.java
public static void main(String[] argv) throws Exception { List list1 = new ArrayList(); List list2 = new ArrayList(); list1.addAll(list2);// ww w .j av a2s . co m list1.removeAll(list2); list1.retainAll(list2); list1.clear(); int newSize = 2; list1.subList(newSize, list1.size()).clear(); }
From source file:Test.java
public static void main(String[] args) { List<String> list = new ArrayList<>(); List<Map<String, List<String>>> stringList = new ArrayList<>(); }
From source file:Main.java
public static void main(String[] args) { ArrayList<String> aList = new ArrayList<String>(); aList.add("1"); aList.add("2"); aList.add("3"); aList.add("4"); aList.add("java2s.com"); ListIterator listIterator = aList.listIterator(); while (listIterator.hasNext()) { System.out.println(listIterator.next()); }//from w w w.j a v a 2 s.c o m }