List of usage examples for java.util ArrayList add
public boolean add(E e)
From source file:Main.java
public static <T> List<T> indexedSelection(List<T> in, int... indices) { ArrayList<T> res = new ArrayList<T>(); for (int i : indices) res.add(in.get(i)); return res;/*from w w w . j av a 2 s . c o m*/ }
From source file:Main.java
private static <E> ArrayList<E> makeCollection(Iterable<E> iter) { ArrayList<E> list = new ArrayList<E>(); for (E item : iter) { list.add(item); }/*from w w w . ja va 2 s . c om*/ return list; }
From source file:net.bluehornreader.misc.BluehornReader.java
static void tst2() throws Exception { LowLevelDbAccess lowLevelDbAccess = new LowLevelDbAccess(); ReadArticlesColl.DB db = new ReadArticlesColl.DB(lowLevelDbAccess); ReadArticlesColl rd = new ReadArticlesColl("usr1", "feed1"); rd.markRead(10, 20);/* w w w . jav a2 s. co m*/ ArrayList<ReadArticlesColl> ra = new ArrayList<>(); ra.add(rd); db.add(ra); ReadArticlesColl get = db.get("usr1", "feed1"); LOG.info(get); //LOG.info("duration (ms): " + (e - b)); lowLevelDbAccess.shutDown(); }
From source file:Main.java
public static ArrayList splitStringByCharC(String str, String c) { StringTokenizer en = new StringTokenizer(str, c); ArrayList vec = new ArrayList(); while (en.hasMoreElements()) vec.add(en.nextElement()); return vec;//from ww w .ja v a 2 s . co m }
From source file:Main.java
public static boolean hasImageCaptureBug() { // list of known devices that have the bug ArrayList<String> devices = new ArrayList<String>(); devices.add("android-devphone1/dream_devphone/dream"); devices.add("generic/sdk/generic"); devices.add("vodafone/vfpioneer/sapphire"); devices.add("tmobile/kila/dream"); devices.add("verizon/voles/sholes"); devices.add("google_ion/google_ion/sapphire"); devices.add("SEMC/X10i_1232-9897/X10i"); return devices .contains(android.os.Build.BRAND + "/" + android.os.Build.PRODUCT + "/" + android.os.Build.DEVICE); }
From source file:Main.java
public static <T> List<T> asList(T... args) { ArrayList<T> rv = new ArrayList<T>(); for (T a : args) { rv.add(a); }/* w w w .j a v a 2s . c o m*/ return rv; }
From source file:net.reichholf.dreamdroid.helpers.enigma2.Message.java
public static ArrayList<NameValuePair> getParams(ExtendedHashMap message) { ArrayList<NameValuePair> params = new ArrayList<>(); params.add(new BasicNameValuePair("text", message.getString(KEY_TEXT))); params.add(new BasicNameValuePair("type", message.getString(KEY_TYPE))); params.add(new BasicNameValuePair("timeout", message.getString(KEY_TIMEOUT))); return params; }
From source file:Main.java
public static <T> ArrayList<T> toArrayList(T... arr) { ArrayList<T> list = new ArrayList<T>(arr.length); for (T t : arr) list.add(t); return list;/*w w w.ja v a 2 s . c o m*/ }
From source file:Main.java
public static <K> ArrayList<K> toArrayList(Collection<K> col) { if (col == null) { return new ArrayList<K>(); }/*from www . j ava 2 s . co m*/ ArrayList<K> result = new ArrayList<K>(); for (K k : col) { result.add(k); } return result; }
From source file:Main.java
public static <T> List<T> list(T... items) { ArrayList<T> out = new ArrayList<T>(); for (T t : items) { out.add(t); }/*from w w w . java2 s. co m*/ return out; }