Guava migration - Preliminary

This commit is contained in:
Jetz
2024-09-02 12:03:59 -04:00
parent 17ffe17e9d
commit b46c1deeb4
5 changed files with 16 additions and 17 deletions

View File

@@ -196,7 +196,7 @@ public final class CardRulesPredicates {
try {
return CardRulesPredicates.coreType(isEqual, Enum.valueOf(CardType.CoreType.class, what));
} catch (final Exception e) {
return com.google.common.base.Predicates.alwaysFalse();
return x -> false;
}
}
@@ -226,7 +226,7 @@ public final class CardRulesPredicates {
try {
return CardRulesPredicates.superType(isEqual, Enum.valueOf(CardType.Supertype.class, what));
} catch (final Exception e) {
return com.google.common.base.Predicates.alwaysFalse();
return x -> false;
}
}

View File

@@ -123,14 +123,12 @@ public class DeckHints {
for (Pair<Type, String> pair : filters) {
Type type = pair.getLeft();
String param = pair.getRight();
Iterable<PaperCard> cards = getCardsForFilter(cardList, type, param);
if (cards != null) {
// if a type is used more than once intersect respective matches
if (ret.containsKey(type)) {
Iterables.retainAll(cards, new FCollection<>(ret.get(type)));
}
ret.put(type, cards);
List<PaperCard> cards = getCardsForFilter(cardList, type, param);
// if a type is used more than once intersect respective matches
if (ret.containsKey(type)) {
cards.retainAll(new FCollection<>(ret.get(type)));
}
ret.put(type, cards);
}
return ret;
}
@@ -166,7 +164,7 @@ public class DeckHints {
return pair;
}
private Iterable<PaperCard> getCardsForFilter(Iterable<PaperCard> cardList, Type type, String param) {
private List<PaperCard> getCardsForFilter(Iterable<PaperCard> cardList, Type type, String param) {
List<PaperCard> cards = new ArrayList<>();
// this is case ABILITY, but other types can also use this when the implicit parsing would miss