List of usage examples for java.util ArrayList add
public boolean add(E e)
From source file:Main.java
public static final ArrayList singletonArrayList(Object o) { final ArrayList result = new ArrayList(1); result.add(o); return result; }
From source file:Main.java
/** * Combines a element and a list into a new list. * /*from www .jav a2 s .com*/ * @param t First element of the new list. * @param list Rest elements of the new list. */ public static <T extends Object> List<T> union(final T t, final List<T> list) { final ArrayList<T> result = new ArrayList<T>(); result.add(t); result.addAll(list); return result; }
From source file:Main.java
public static <T> List<T> cons(T x, Collection<? extends T> xs) { ArrayList<T> result = new ArrayList<>(xs.size() + 1); result.add(x); result.addAll(xs);/*from ww w . j a va 2s .c o m*/ return result; }
From source file:Main.java
/** * Adds one wanted config attrib to list of configuration attributes * //from ww w .j av a2s . c o m * @param configs * @param configAttrib * @param value */ public static void setConfig(ArrayList<int[]> configs, int configAttrib, int value) { configs.add(new int[] { configAttrib, value }); }
From source file:Main.java
private static ArrayList<String> createCountrysName() { ArrayList<String> countrysTmp = new ArrayList<String>(); countrysTmp.add("Brasil"); return countrysTmp; }
From source file:Main.java
private static ArrayList<String> createCountrysId() { ArrayList<String> countrysTmp = new ArrayList<String>(); countrysTmp.add("BR"); return countrysTmp; }
From source file:Main.java
public static List buildInitializedList(Object value) { final ArrayList<Object> arrayList = new ArrayList<Object>(); arrayList.add(value); return arrayList; }
From source file:Main.java
public static void reverseMethod() { ArrayList<String> list = new ArrayList<String>(); list.add("Z"); list.add("A"); list.add("K"); list.add("N"); System.out.println(list);/*from www .j a v a 2s .c o m*/ Collections.reverse(list); System.out.println(list); }
From source file:Main.java
public static ArrayList<Integer> createOccupantsIdsFromPrivateMessage(int currentUserId, int senderId) { ArrayList<Integer> occupantsIdsList = new ArrayList<Integer>(2); occupantsIdsList.add(currentUserId); occupantsIdsList.add(senderId);/* w w w .j ava 2s.c o m*/ return occupantsIdsList; }
From source file:Main.java
public static <T> List<T> toList(T atLeastOneT, T... otherTs) { ArrayList<T> allTs = new ArrayList<T>(Arrays.asList(otherTs)); allTs.add(atLeastOneT); return allTs; }