mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-11 16:26:22 +00:00
Guava migration - Use .toList()
This commit is contained in:
@@ -51,7 +51,7 @@ public class QuestController {
|
||||
toReturn.addElement(enemyTags.get(i));
|
||||
}
|
||||
|
||||
List<Object> sortedObjects = Arrays.stream(toReturn.toArray()).sorted().collect(Collectors.toList());
|
||||
List<Object> sortedObjects = Arrays.stream(toReturn.toArray()).sorted().toList();
|
||||
|
||||
toReturn.clear();
|
||||
|
||||
@@ -69,7 +69,7 @@ public class QuestController {
|
||||
toReturn.addElement(POITags.get(i));
|
||||
}
|
||||
|
||||
List<Object> sortedObjects = Arrays.stream(toReturn.toArray()).sorted().collect(Collectors.toList());
|
||||
List<Object> sortedObjects = Arrays.stream(toReturn.toArray()).sorted().toList();
|
||||
|
||||
toReturn.clear();
|
||||
|
||||
@@ -89,7 +89,7 @@ public class QuestController {
|
||||
toReturn.addElement(questSourceTags.get(i));
|
||||
}
|
||||
|
||||
List<Object> sortedObjects = Arrays.stream(toReturn.toArray()).sorted().collect(Collectors.toList());
|
||||
List<Object> sortedObjects = Arrays.stream(toReturn.toArray()).sorted().toList();
|
||||
|
||||
toReturn.clear();
|
||||
|
||||
|
||||
@@ -283,7 +283,7 @@ public final class CardDb implements ICardDatabase, IDeckGenPool {
|
||||
if (cr.hasFunctionalVariants()) {
|
||||
cardsInSet = cardsInSet.stream().filter(c -> StringUtils.isEmpty(c.functionalVariantName)
|
||||
|| cr.getSupportedFunctionalVariants().contains(c.functionalVariantName)
|
||||
).collect(Collectors.toList());
|
||||
).toList();
|
||||
}
|
||||
if (cardsInSet.isEmpty())
|
||||
return false;
|
||||
|
||||
@@ -48,7 +48,7 @@ public class TokenCreateTable extends ForwardingTable<Player, Card, Integer> {
|
||||
|
||||
if (validOwner != null) {
|
||||
Predicate<GameObject> restriction = GameObjectPredicates.restriction(validOwner.split(","), host.getController(), host, ctb);
|
||||
filteredPlayer = rowKeySet().stream().filter(restriction).collect(Collectors.toList());
|
||||
filteredPlayer = rowKeySet().stream().filter(restriction).toList();
|
||||
if (filteredPlayer.isEmpty()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -447,7 +447,7 @@ public class EnemySprite extends CharacterSprite implements Steerable<Vector2> {
|
||||
if (Current.latestDeck() != null) {
|
||||
List<PaperCard> paperCardList = Current.latestDeck().getMain().toFlatList().stream()
|
||||
.filter(paperCard -> !paperCard.isVeryBasicLand() && !paperCard.getName().startsWith("Mox"))
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
//random uncommons from deck
|
||||
List<PaperCard> uncommonCards = paperCardList.stream()
|
||||
.filter(paperCard -> CardRarity.Uncommon.equals(paperCard.getRarity()) || CardRarity.Special.equals(paperCard.getRarity()))
|
||||
|
||||
@@ -326,7 +326,7 @@ public class AdventureEventData implements Serializable {
|
||||
Iterable<CardBlock> src = FModel.getBlocks(); //all blocks
|
||||
Predicate<CardEdition> filter = CardEdition.Predicates.CAN_MAKE_BOOSTER.and(selectSetPool());
|
||||
List<CardEdition> allEditions = new ArrayList<>();
|
||||
StreamSupport.stream(editions.spliterator(), false).filter(filter).filter(CardEdition::hasBoosterTemplate).collect(Collectors.toList()).iterator().forEachRemaining(allEditions::add);
|
||||
StreamSupport.stream(editions.spliterator(), false).filter(filter).filter(CardEdition::hasBoosterTemplate).toList().iterator().forEachRemaining(allEditions::add);
|
||||
|
||||
//Temporary restriction until rewards are more diverse - don't want to award restricted cards so these editions need different rewards added.
|
||||
List<String> restrictedDrafts = new ArrayList<>();
|
||||
|
||||
@@ -166,7 +166,7 @@ public class AdventureQuestStage implements Serializable {
|
||||
return worldMapOK;
|
||||
}
|
||||
if (targetPOI == null) {
|
||||
List<String> enteredTags = Arrays.stream(locationToCheck.getData().questTags).collect(Collectors.toList());
|
||||
List<String> enteredTags = Arrays.stream(locationToCheck.getData().questTags).toList();
|
||||
for (String tag : POITags) {
|
||||
if (!enteredTags.contains(tag)) {
|
||||
return false;
|
||||
|
||||
@@ -163,7 +163,7 @@ public class SpellSmithScene extends UIScene {
|
||||
return false;
|
||||
}
|
||||
List<PaperCard> it = StreamSupport.stream(RewardData.getAllCards().spliterator(), false)
|
||||
.filter(input2 -> input2.getEdition().equals(input.getCode())).collect(Collectors.toList());
|
||||
.filter(input2 -> input2.getEdition().equals(input.getCode())).toList();
|
||||
if (it.size() == 0)
|
||||
return false;
|
||||
ConfigData configData = Config.instance().getConfigData();
|
||||
|
||||
@@ -40,7 +40,7 @@ public class AdventureQuestController implements Serializable {
|
||||
continue;
|
||||
}
|
||||
for (EnemyData enemy : WorldData.getAllEnemies()) {
|
||||
List<String> candidateTags = Arrays.stream(enemy.questTags).collect(Collectors.toList());
|
||||
List<String> candidateTags = Arrays.stream(enemy.questTags).toList();
|
||||
boolean match = true;
|
||||
for (String targetTag : c.enemyTags) {
|
||||
if (!candidateTags.contains(targetTag)) {
|
||||
@@ -73,7 +73,7 @@ public class AdventureQuestController implements Serializable {
|
||||
List<String> toBoost = new ArrayList<>();
|
||||
if (c.mixedEnemies){
|
||||
for (EnemyData enemy : localSpawns){
|
||||
List<String> candidateTags = Arrays.stream(enemy.questTags).collect(Collectors.toList());
|
||||
List<String> candidateTags = Arrays.stream(enemy.questTags).toList();
|
||||
boolean match = true;
|
||||
for (String targetTag : c.enemyTags) {
|
||||
if (!candidateTags.contains(targetTag)) {
|
||||
|
||||
@@ -820,7 +820,7 @@ public class CardUtil {
|
||||
? FModel.getMagicDb().getCommonCards().getAllCards(cardName)
|
||||
: FModel.getMagicDb().getCommonCards().getUniqueCardsNoAlt(cardName);
|
||||
List<PaperCard> validCards = cardPool.stream()
|
||||
.filter(input -> input.getEdition().equals(edition)).collect(Collectors.toList());
|
||||
.filter(input -> input.getEdition().equals(edition)).toList();
|
||||
|
||||
if (validCards.isEmpty()) {
|
||||
System.err.println("Unexpected behavior: tried to call getCardByNameAndEdition for card " + cardName + " from the edition " + edition + ", but didn't find it in the DB. A random existing instance will be returned.");
|
||||
|
||||
@@ -147,7 +147,7 @@ public final class CardRelationMatrixGenerator {
|
||||
}
|
||||
|
||||
//filter to just legal commanders
|
||||
List<PaperCard> legends = cardList.stream().filter(format.isLegalCommanderPredicate()).collect(Collectors.toList());
|
||||
List<PaperCard> legends = cardList.stream().filter(format.isLegalCommanderPredicate()).toList();
|
||||
|
||||
//generate lookups for legends to link commander names to matrix rows
|
||||
for (int i=0; i<legends.size(); ++i){
|
||||
|
||||
@@ -397,7 +397,7 @@ public class CardThemedDeckBuilder extends DeckGeneratorBase {
|
||||
if(secondKeyCard!=null && !secondKeyCard.getRules().getMainPart().getType().isLand()) {
|
||||
final List<PaperCard> keyCardList = aiPlayables.stream()
|
||||
.filter(PaperCardPredicates.name(secondKeyCard.getName()))
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
deckList.addAll(keyCardList);
|
||||
aiPlayables.removeAll(keyCardList);
|
||||
rankedColorList.removeAll(keyCardList);
|
||||
@@ -418,7 +418,7 @@ public class CardThemedDeckBuilder extends DeckGeneratorBase {
|
||||
if(secondKeyCard!=null && secondKeyCard.getRules().getMainPart().getType().isLand()) {
|
||||
final List<PaperCard> keyCardList = aiPlayables.stream()
|
||||
.filter(PaperCardPredicates.name(secondKeyCard.getName()))
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
deckList.addAll(keyCardList);
|
||||
aiPlayables.removeAll(keyCardList);
|
||||
rankedColorList.removeAll(keyCardList);
|
||||
@@ -443,7 +443,7 @@ public class CardThemedDeckBuilder extends DeckGeneratorBase {
|
||||
* If evolving wilds is in the deck and there are fewer than 4 spaces for basic lands - remove evolving wilds
|
||||
*/
|
||||
protected void checkEvolvingWilds(){
|
||||
List<PaperCard> evolvingWilds = deckList.stream().filter(PaperCardPredicates.name("Evolving Wilds")).collect(Collectors.toList());
|
||||
List<PaperCard> evolvingWilds = deckList.stream().filter(PaperCardPredicates.name("Evolving Wilds")).toList();
|
||||
if((evolvingWilds.size()>0 && landsNeeded<4 ) || colors.countColors()<2){
|
||||
deckList.removeAll(evolvingWilds);
|
||||
landsNeeded=landsNeeded+evolvingWilds.size();
|
||||
|
||||
@@ -140,12 +140,12 @@ public class QuestUtilUnlockSets {
|
||||
// Sort current sets by date
|
||||
List<CardEdition> allowedSets = qData.getFormat().getAllowedSetCodes().stream()
|
||||
.map(editions::get)
|
||||
.sorted().collect(Collectors.toList());
|
||||
.sorted().toList();
|
||||
|
||||
// Sort unlockable sets by date
|
||||
List<CardEdition> excludedSets = qData.getFormat().getLockedSets().stream()
|
||||
.map(editions::get)
|
||||
.sorted().collect(Collectors.toList());
|
||||
.sorted().toList();
|
||||
|
||||
// get a number of sets between an excluded and any included set
|
||||
List<ImmutablePair<CardEdition, Long>> excludedWithDistances = new ArrayList<>();
|
||||
|
||||
@@ -1885,7 +1885,7 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
|
||||
if (possibleReplacers.size() == 1) {
|
||||
return first;
|
||||
}
|
||||
final List<String> res = possibleReplacers.stream().map(ReplacementEffect::toString).collect(Collectors.toList());
|
||||
final List<String> res = possibleReplacers.stream().map(ReplacementEffect::toString).toList();
|
||||
final String firstStr = res.get(0);
|
||||
final String prompt = localizer.getMessage("lblChooseFirstApplyReplacementEffect");
|
||||
for (int i = 1; i < res.size(); i++) {
|
||||
@@ -1907,7 +1907,7 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
|
||||
if (possibleStatics.size() == 1 || !fullControl) {
|
||||
return first;
|
||||
}
|
||||
final List<String> sts = possibleStatics.stream().map(StaticAbility::toString).collect(Collectors.toList());
|
||||
final List<String> sts = possibleStatics.stream().map(StaticAbility::toString).toList();
|
||||
final String firstStr = sts.get(0);
|
||||
for (int i = 1; i < sts.size(); i++) {
|
||||
// prompt user if there are multiple different options
|
||||
|
||||
@@ -304,7 +304,7 @@ public final class LDAModelGenetrator {
|
||||
//filter to just legal commanders
|
||||
List<PaperCard> legends = cardList.stream()
|
||||
.filter(PaperCardPredicates.fromRules(DeckFormat.Commander::isLegalCommander))
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
|
||||
//generate lookups for legends to link commander names to matrix rows
|
||||
for (int i=0; i<legends.size(); ++i){
|
||||
|
||||
Reference in New Issue
Block a user