From d4e0ed23bcef8212b38050388afd907b9d50a7f1 Mon Sep 17 00:00:00 2001 From: punchready Date: Thu, 3 Jun 2021 23:15:29 +0200 Subject: [PATCH] fix: rollback ArrayTools because less is more --- .../uulm/teamname/marvelous/gamelibrary/ArrayTools.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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; } }