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() {
Set<Card> actualDeck = deck.getCards();
for(Card card : deckCards)
actualDeck.add(card);
actualDeck.addAll(deckCards);
return deck;
}

View file

@ -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();
}

View file

@ -22,9 +22,7 @@ public class TournamentMatchesTableModel extends AbstractTableModel {
List<TournamentGameView> 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();

View file

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

View file

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