diff options
-rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java | 13 |
1 files changed, 0 insertions, 13 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java b/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java index 00a6e5f4..f09883eb 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java @@ -48,8 +48,6 @@ import java.nio.FloatBuffer; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.util.*; -import java.util.concurrent.atomic.AtomicReference; -import java.util.function.BiFunction; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -1476,15 +1474,4 @@ public class Utils { return left <= x && x <= left + width && top <= y && y <= top + height; } - - public static <T, U> List<U> runningReduce(Iterable<T> values, U initial, BiFunction<T, U, U> reducer) { - Spliterator<T> spliterator = values.spliterator(); - long size = spliterator.estimateSize(); - List<U> rets = new ArrayList<>(Math.toIntExact(size == Long.MAX_VALUE ? 0 : size)); - AtomicReference<U> acc = new AtomicReference<>(initial); - spliterator.forEachRemaining(it -> { - acc.getAndUpdate(value -> reducer.apply(it, value)); - }); - return rets; - } } |