Java tutorial
//package com.java2s; import java.util.ArrayList; import java.util.Collection; public class Main { public static <T> Collection<T> arrayToCollection(final T[] array) { int length = array == null ? 0 : array.length; ArrayList<T> al = new ArrayList<T>(length); for (int i = 0; i < length; i++) { al.add(array[i]); } return al; } }