From 8b31333d9dc739faf84710b07f0546a2a9c26638 Mon Sep 17 00:00:00 2001 From: "vyacheslav.raskulin" Date: Wed, 9 Sep 2020 15:03:01 +0300 Subject: [PATCH] Collection creation is simplified --- .../java/mage/client/deck/generator/DeckGeneratorPool.java | 3 +-- .../src/main/java/mage/client/deckeditor/CardSelector.java | 4 +--- .../java/mage/client/table/TournamentMatchesTableModel.java | 4 +--- .../mage/plugins/card/dl/sources/CopyPasteImageSource.java | 3 +-- .../src/main/java/mage/server/util/ServerMessagesUtil.java | 3 +-- 5 files changed, 5 insertions(+), 12 deletions(-) diff --git a/Mage.Client/src/main/java/mage/client/deck/generator/DeckGeneratorPool.java b/Mage.Client/src/main/java/mage/client/deck/generator/DeckGeneratorPool.java index cf77d9d09e..d8dd0e06c2 100644 --- a/Mage.Client/src/main/java/mage/client/deck/generator/DeckGeneratorPool.java +++ b/Mage.Client/src/main/java/mage/client/deck/generator/DeckGeneratorPool.java @@ -311,8 +311,7 @@ public class DeckGeneratorPool */ public Deck getDeck() { Set actualDeck = deck.getCards(); - for(Card card : deckCards) - actualDeck.add(card); + actualDeck.addAll(deckCards); return deck; } diff --git a/Mage.Client/src/main/java/mage/client/deckeditor/CardSelector.java b/Mage.Client/src/main/java/mage/client/deckeditor/CardSelector.java index bb5b35ef29..58c358e86e 100644 --- a/Mage.Client/src/main/java/mage/client/deckeditor/CardSelector.java +++ b/Mage.Client/src/main/java/mage/client/deckeditor/CardSelector.java @@ -205,9 +205,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene this.btnExpansionSearch.setVisible(false); this.limited = true; this.cards.clear(); - for (Card card : sideboard) { - this.cards.add(card); - } + this.cards.addAll(sideboard); filterCards(); } diff --git a/Mage.Client/src/main/java/mage/client/table/TournamentMatchesTableModel.java b/Mage.Client/src/main/java/mage/client/table/TournamentMatchesTableModel.java index 288a5c70f7..9a39c69207 100644 --- a/Mage.Client/src/main/java/mage/client/table/TournamentMatchesTableModel.java +++ b/Mage.Client/src/main/java/mage/client/table/TournamentMatchesTableModel.java @@ -22,9 +22,7 @@ public class TournamentMatchesTableModel extends AbstractTableModel { List views = new ArrayList<>(); watchingAllowed = tournament.isWatchingAllowed(); for (RoundView round : tournament.getRounds()) { - for (TournamentGameView game : round.getGames()) { - views.add(game); - } + views.addAll(round.getGames()); } games = views.toArray(new TournamentGameView[0]); this.fireTableDataChanged(); diff --git a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/CopyPasteImageSource.java b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/CopyPasteImageSource.java index 0011134ab3..8f76b84992 100644 --- a/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/CopyPasteImageSource.java +++ b/Mage.Client/src/main/java/org/mage/plugins/card/dl/sources/CopyPasteImageSource.java @@ -232,12 +232,11 @@ public enum CopyPasteImageSource implements CardImageSource { @Override public List getSupportedSets() { setupLinks(); - List supportedSetsCopy = new ArrayList<>(); if (supportedSets.isEmpty()) { supportedSets.addAll(Sets.getInstance().keySet()); } - supportedSetsCopy.addAll(supportedSets); + List supportedSetsCopy = new ArrayList<>(supportedSets); return supportedSetsCopy; } diff --git a/Mage.Server/src/main/java/mage/server/util/ServerMessagesUtil.java b/Mage.Server/src/main/java/mage/server/util/ServerMessagesUtil.java index 791beceaef..61a59dccf9 100644 --- a/Mage.Server/src/main/java/mage/server/util/ServerMessagesUtil.java +++ b/Mage.Server/src/main/java/mage/server/util/ServerMessagesUtil.java @@ -58,8 +58,7 @@ public enum ServerMessagesUtil { private void reloadMessages() { LOGGER.debug("Reading server messages..."); List motdMessages = readFromFile(); - List newMessages = new ArrayList<>(); - newMessages.addAll(motdMessages); + List newMessages = new ArrayList<>(motdMessages); newMessages.add(getServerStatistics()); newMessages.add(getServerStatistics2());