forked from External/mage
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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue