mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 19:58:00 +00:00
Guava migration - Inline Iterables.all (Collection overload)
This commit is contained in:
@@ -66,9 +66,6 @@ public class Iterables {
|
||||
public static <T> Iterable<T> filter(Collection<T> iterable, Predicate<? super T> filter) {
|
||||
return () -> iterable.stream().filter(filter).iterator();
|
||||
}
|
||||
public static <T> boolean all(Collection<T> iterable, Predicate<? super T> test) {
|
||||
return iterable.stream().allMatch(test);
|
||||
}
|
||||
|
||||
|
||||
public static int size(Collection<?> collection) {
|
||||
|
||||
@@ -4,7 +4,6 @@ import forge.game.Game;
|
||||
import forge.game.player.Player;
|
||||
import forge.game.player.PlayerCollection;
|
||||
import forge.game.player.PlayerPredicates;
|
||||
import forge.util.Iterables;
|
||||
import forge.util.Localizer;
|
||||
|
||||
public class AgainstAllOdds extends Achievement {
|
||||
@@ -25,9 +24,9 @@ public class AgainstAllOdds extends Achievement {
|
||||
for (Player opp : player.getRegisteredOpponents()) {
|
||||
PlayerCollection otherOpps = player.getRegisteredOpponents();
|
||||
otherOpps.remove(opp);
|
||||
if (Iterables.all(otherOpps, PlayerPredicates.sameTeam(opp))) {
|
||||
if (otherOpps.stream().allMatch(PlayerPredicates.sameTeam(opp))) {
|
||||
teamNum++;
|
||||
} else if (Iterables.all(otherOpps, PlayerPredicates.sameTeam(opp).negate())) {
|
||||
} else if (otherOpps.stream().allMatch(PlayerPredicates.sameTeam(opp).negate())) {
|
||||
teamNum--;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user