package uulm.teamname.marvelous.gamelibrary; import java.util.ArrayList; import java.util.Arrays; /** Provides various tools for Arrays. */ public class ArrayTools { /** * Returns a variable-size array list backed by the specified array without allocating more memory than necessary. * @param the class of the objects in the array * @param a the array by which the list will be backed * @return a list view of the specified array * @throws NullPointerException if the specified array is {@code null} */ public static ArrayList toArrayList(E[] a) { ArrayList l = new ArrayList<>(a.length); l.addAll(Arrays.asList(a)); return l; } }