diff options
| author | Danielshe <shekwancheung0528@gmail.com> | 2019-11-03 19:02:00 +0800 |
|---|---|---|
| committer | Danielshe <shekwancheung0528@gmail.com> | 2019-11-03 19:02:00 +0800 |
| commit | ad7f945d6f724d51ee843b334838fda84c6197f2 (patch) | |
| tree | b67cd5a1b95826435ef54813e4221ff3fda39212 /src/main/java/me/shedaniel/rei/utils/CollectionUtils.java | |
| parent | 9f5a9eae9a7863412cc5eb433bf15e5ee71da616 (diff) | |
| download | RoughlyEnoughItems-ad7f945d6f724d51ee843b334838fda84c6197f2.tar.gz RoughlyEnoughItems-ad7f945d6f724d51ee843b334838fda84c6197f2.tar.bz2 RoughlyEnoughItems-ad7f945d6f724d51ee843b334838fda84c6197f2.zip | |
API Changes
Diffstat (limited to 'src/main/java/me/shedaniel/rei/utils/CollectionUtils.java')
| -rw-r--r-- | src/main/java/me/shedaniel/rei/utils/CollectionUtils.java | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/main/java/me/shedaniel/rei/utils/CollectionUtils.java b/src/main/java/me/shedaniel/rei/utils/CollectionUtils.java index 1db59e54e..d2b7eb92a 100644 --- a/src/main/java/me/shedaniel/rei/utils/CollectionUtils.java +++ b/src/main/java/me/shedaniel/rei/utils/CollectionUtils.java @@ -1,3 +1,8 @@ +/* + * Roughly Enough Items by Danielshe. + * Licensed under the MIT License. + */ + package me.shedaniel.rei.utils; import me.shedaniel.rei.api.EntryStack; @@ -151,6 +156,14 @@ public class CollectionUtils { return sum; } + public static final <T> int sumInt(List<Integer> list) { + int sum = 0; + for (Integer t : list) { + sum += t; + } + return sum; + } + public static final <T> double sumDouble(List<T> list, Function<T, Double> function) { double sum = 0; for (T t : list) { @@ -158,4 +171,12 @@ public class CollectionUtils { } return sum; } + + public static final <T> double sumDouble(List<Double> list) { + double sum = 0; + for (Double t : list) { + sum += t; + } + return sum; + } } |
