Android examples for java.util:Collection
Takes any collection and turns it into an java.util.ArrayList
//package com.book2s; import java.util.ArrayList; import java.util.Collection; public class Main { public static void main(String[] argv) { Collection collection = java.util.Arrays.asList("asdf", "book2s.com"); System.out.println(asArrayList(collection)); }/*from w w w .j a v a 2s . c o m*/ /** * Takes any collection and turns it into an {@link java.util.ArrayList} * @param collection * @param <E> * @return */ public static <E> ArrayList<E> asArrayList(Collection<E> collection) { ArrayList<E> arrayList = new ArrayList<>(); arrayList.addAll(collection); return arrayList; } }