mirror of
https://github.com/magefree/mage.git
synced 2025-12-23 20:11:59 -08:00
change some size() comparisons, to isEmpty()
This commit is contained in:
parent
5ba206111a
commit
eb0cfc94f8
23 changed files with 35 additions and 36 deletions
|
|
@ -352,7 +352,7 @@ public class MageBook extends JComponent {
|
|||
List<Plane> planes = getPlanes(currentPage, currentSet, numTokensEmblems);
|
||||
int numPlanes = 0;
|
||||
|
||||
if (planes != null && planes.size() > 0) {
|
||||
if (!planes.isEmpty()) {
|
||||
int size = planes.size();
|
||||
numPlanes = size;
|
||||
Rectangle rectangle = new Rectangle();
|
||||
|
|
@ -523,7 +523,7 @@ public class MageBook extends JComponent {
|
|||
// second run for empty numbers
|
||||
int countHave = haveNumbers.size();
|
||||
int countNotHave = 0;
|
||||
if (cards.size() > 0) {
|
||||
if (!cards.isEmpty()) {
|
||||
for (int i = startNumber; i <= endNumber; i++) {
|
||||
if (!haveNumbers.contains(i)) {
|
||||
countNotHave++;
|
||||
|
|
@ -593,8 +593,8 @@ public class MageBook extends JComponent {
|
|||
}
|
||||
|
||||
private List<Emblem> getEmblems(int page, String set, int numTokensEmblems) {
|
||||
ArrayList<CardDownloadData> allEmblems = getTokenCardUrls();
|
||||
ArrayList<Emblem> emblems = new ArrayList<>();
|
||||
List<CardDownloadData> allEmblems = getTokenCardUrls();
|
||||
List<Emblem> emblems = new ArrayList<>();
|
||||
|
||||
for (CardDownloadData emblem : allEmblems) {
|
||||
if (emblem.getSet().equals(set)) {
|
||||
|
|
@ -650,8 +650,8 @@ public class MageBook extends JComponent {
|
|||
}
|
||||
|
||||
private List<Plane> getPlanes(int page, String set, int numTokensEmblems) {
|
||||
ArrayList<CardDownloadData> allPlanes = getTokenCardUrls();
|
||||
ArrayList<Plane> planes = new ArrayList<>();
|
||||
List<CardDownloadData> allPlanes = getTokenCardUrls();
|
||||
List<Plane> planes = new ArrayList<>();
|
||||
|
||||
for (CardDownloadData plane : allPlanes) {
|
||||
if (plane.getSet().equals(set)) {
|
||||
|
|
|
|||
|
|
@ -198,7 +198,7 @@ public class RandomPacksSelectorDialog extends javax.swing.JDialog {
|
|||
public void doApply() {
|
||||
if (getSelectedPacks().size() < 2 && isRandomDraft) {
|
||||
JOptionPane.showMessageDialog(this, "At least 2 sets must be selected", "Error", JOptionPane.ERROR_MESSAGE);
|
||||
} else if (getSelectedPacks().size() < 1 && isRichManDraft) {
|
||||
} else if (getSelectedPacks().isEmpty() && isRichManDraft) {
|
||||
JOptionPane.showMessageDialog(this, "At least 1 set must be selected", "Error", JOptionPane.ERROR_MESSAGE);
|
||||
} else {
|
||||
this.setVisible(false);
|
||||
|
|
|
|||
|
|
@ -1212,7 +1212,7 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
needPlayable = new HashSet<>();
|
||||
}
|
||||
|
||||
if (needChoosen.size() == 0 && needSelectable.size() == 0 && needPlayable.size() == 0) {
|
||||
if (needChoosen.isEmpty() && needSelectable.isEmpty() && needPlayable.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -365,7 +365,7 @@ public class HelperPanel extends JPanel {
|
|||
this.mainPanel.setOpaque(false);
|
||||
}
|
||||
|
||||
if (buttons.size() == 0) {
|
||||
if (buttons.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
|||
private boolean isCardsPlayable(Collection<CardView> cards, GameView gameView, Set<UUID> possibleTargets) {
|
||||
if (cards != null) {
|
||||
// can play
|
||||
if (gameView != null && gameView.getCanPlayObjects() != null && gameView.getCanPlayObjects().size() > 0) {
|
||||
if (gameView != null && gameView.getCanPlayObjects() != null && !gameView.getCanPlayObjects().isEmpty()) {
|
||||
for (CardView card : cards) {
|
||||
if (gameView.getCanPlayObjects().contains(card.getId())) {
|
||||
return true;
|
||||
|
|
@ -148,7 +148,7 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
|||
}
|
||||
}
|
||||
// can select
|
||||
if (possibleTargets != null && possibleTargets.size() > 0) {
|
||||
if (possibleTargets != null && !possibleTargets.isEmpty()) {
|
||||
for (CardView card : cards) {
|
||||
if (possibleTargets.contains(card.getId())) {
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -145,7 +145,7 @@ public enum CopyPasteImageSource implements CardImageSource {
|
|||
final CopyPasteImageSourceDialog dialog = new CopyPasteImageSourceDialog();
|
||||
dialog.pack();
|
||||
int count = 0;
|
||||
if (viewMissingCards && missingCards.size() > 0 && singleLinks.size() == 0) {
|
||||
if (viewMissingCards && !missingCards.isEmpty() && singleLinks.isEmpty()) {
|
||||
viewMissingCards = false;
|
||||
String displayMissingCardsStr = "Up to the first 20 cards are:\n";
|
||||
String missingCardsStr = "";
|
||||
|
|
@ -228,7 +228,7 @@ public enum CopyPasteImageSource implements CardImageSource {
|
|||
public ArrayList<String> getSupportedSets() {
|
||||
setupLinks();
|
||||
ArrayList<String> supportedSetsCopy = new ArrayList<>();
|
||||
if (supportedSets.size() == 0) {
|
||||
if (supportedSets.isEmpty()) {
|
||||
for (String setCode : Sets.getInstance().keySet()) {
|
||||
supportedSets.add(setCode);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -238,16 +238,16 @@ public class GathererSets implements Iterable<DownloadJob> {
|
|||
// 2. missing rarity icon:
|
||||
// WARNING, need too much time (60+ secs), only for debug mode
|
||||
///*
|
||||
if ((set.getCardsByRarity(Rarity.COMMON).size() > 0) && !res.haveCommon) {
|
||||
if (!set.getCardsByRarity(Rarity.COMMON).isEmpty() && !res.haveCommon) {
|
||||
logger.error(String.format("Symbols: set have common cards, but don't download icon: %s (%s)", set.getCode(), set.getName()));
|
||||
}
|
||||
if ((set.getCardsByRarity(Rarity.UNCOMMON).size() > 0) && !res.haveUncommon) {
|
||||
if (!set.getCardsByRarity(Rarity.UNCOMMON).isEmpty() && !res.haveUncommon) {
|
||||
logger.error(String.format("Symbols: set have uncommon cards, but don't download icon: %s (%s)", set.getCode(), set.getName()));
|
||||
}
|
||||
if ((set.getCardsByRarity(Rarity.RARE).size() > 0) && !res.haveRare) {
|
||||
if (!set.getCardsByRarity(Rarity.RARE).isEmpty() && !res.haveRare) {
|
||||
logger.error(String.format("Symbols: set have rare cards, but don't download icon: %s (%s)", set.getCode(), set.getName()));
|
||||
}
|
||||
if ((set.getCardsByRarity(Rarity.MYTHIC).size() > 0) && !res.haveMyth) {
|
||||
if (!set.getCardsByRarity(Rarity.MYTHIC).isEmpty() && !res.haveMyth) {
|
||||
logger.error(String.format("Symbols: set have mythic cards, but don't download icon: %s (%s)", set.getCode(), set.getName()));
|
||||
}
|
||||
//*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue