Collection creation is simplified

This commit is contained in:
vyacheslav.raskulin 2020-09-09 15:03:01 +03:00
parent 7da043afd0
commit 8b31333d9d
5 changed files with 5 additions and 12 deletions

View file

@ -311,8 +311,7 @@ public class DeckGeneratorPool
*/ */
public Deck getDeck() { public Deck getDeck() {
Set<Card> actualDeck = deck.getCards(); Set<Card> actualDeck = deck.getCards();
for(Card card : deckCards) actualDeck.addAll(deckCards);
actualDeck.add(card);
return deck; return deck;
} }

View file

@ -205,9 +205,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
this.btnExpansionSearch.setVisible(false); this.btnExpansionSearch.setVisible(false);
this.limited = true; this.limited = true;
this.cards.clear(); this.cards.clear();
for (Card card : sideboard) { this.cards.addAll(sideboard);
this.cards.add(card);
}
filterCards(); filterCards();
} }

View file

@ -22,9 +22,7 @@ public class TournamentMatchesTableModel extends AbstractTableModel {
List<TournamentGameView> views = new ArrayList<>(); List<TournamentGameView> views = new ArrayList<>();
watchingAllowed = tournament.isWatchingAllowed(); watchingAllowed = tournament.isWatchingAllowed();
for (RoundView round : tournament.getRounds()) { for (RoundView round : tournament.getRounds()) {
for (TournamentGameView game : round.getGames()) { views.addAll(round.getGames());
views.add(game);
}
} }
games = views.toArray(new TournamentGameView[0]); games = views.toArray(new TournamentGameView[0]);
this.fireTableDataChanged(); this.fireTableDataChanged();

View file

@ -232,12 +232,11 @@ public enum CopyPasteImageSource implements CardImageSource {
@Override @Override
public List<String> getSupportedSets() { public List<String> getSupportedSets() {
setupLinks(); setupLinks();
List<String> supportedSetsCopy = new ArrayList<>();
if (supportedSets.isEmpty()) { if (supportedSets.isEmpty()) {
supportedSets.addAll(Sets.getInstance().keySet()); supportedSets.addAll(Sets.getInstance().keySet());
} }
supportedSetsCopy.addAll(supportedSets); List<String> supportedSetsCopy = new ArrayList<>(supportedSets);
return supportedSetsCopy; return supportedSetsCopy;
} }

View file

@ -58,8 +58,7 @@ public enum ServerMessagesUtil {
private void reloadMessages() { private void reloadMessages() {
LOGGER.debug("Reading server messages..."); LOGGER.debug("Reading server messages...");
List<String> motdMessages = readFromFile(); List<String> motdMessages = readFromFile();
List<String> newMessages = new ArrayList<>(); List<String> newMessages = new ArrayList<>(motdMessages);
newMessages.addAll(motdMessages);
newMessages.add(getServerStatistics()); newMessages.add(getServerStatistics());
newMessages.add(getServerStatistics2()); newMessages.add(getServerStatistics2());