diff --git a/src/main/java/uulm/teamname/marvelous/gamelibrary/ArrayTools.java b/src/main/java/uulm/teamname/marvelous/gamelibrary/ArrayTools.java index 46d770b..f263097 100644 --- a/src/main/java/uulm/teamname/marvelous/gamelibrary/ArrayTools.java +++ b/src/main/java/uulm/teamname/marvelous/gamelibrary/ArrayTools.java @@ -1,7 +1,6 @@ package uulm.teamname.marvelous.gamelibrary; import java.util.ArrayList; -import java.util.Arrays; /** Provides various tools for Arrays. */ public class ArrayTools { @@ -14,7 +13,12 @@ public class ArrayTools { */ public static ArrayList toArrayList(E[] a) { ArrayList l = new ArrayList<>(a.length); - l.addAll(Arrays.asList(a)); + //faster than Collections.addAll(l, a); because it doesn't do any boolean operations + //noinspection ManualArrayToCollectionCopy + for(E e: a) { + //noinspection UseBulkOperation + l.add(e); + } return l; } }