replace [list].size() == 0 and [string].length() == 0 to use .isEmpty() instead

This commit is contained in:
ingmargoudt 2016-09-14 15:27:03 +02:00
parent 3612332607
commit 3128bd2b4b
48 changed files with 90 additions and 109 deletions

View file

@ -85,7 +85,7 @@ public class DraftGrid extends javax.swing.JPanel implements MouseListener {
}
public void loadBooster(CardsView booster, BigCard bigCard) {
if (booster instanceof CardsView && booster.size() == 0) {
if (booster instanceof CardsView && booster.isEmpty()) {
emptyGrid = true;
} else {
if (!emptyGrid) {

View file

@ -126,7 +126,7 @@ public class ChoiceDialog extends IDialogPanel {
}
private void displayCards(CardsView cards, UUID gameId, BigCard bigCard) {
if (cards.size() == 0) {
if (cards.isEmpty()) {
return;
}

View file

@ -103,7 +103,7 @@ public class StackDialog extends IDialogPanel {
private void displayStack(CardsView cards, UUID gameId, BigCard bigCard) {
if (cards == null || cards.size() == 0) {
if (cards == null || cards.isEmpty()) {
return;
}

View file

@ -259,7 +259,7 @@ public class ResetPasswordDialog extends MageDialog {
}// </editor-fold>//GEN-END:initComponents
private void btnGetAuthTokenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGetAuthTokenActionPerformed
if (this.txtEmail.getText().length() == 0) {
if (this.txtEmail.getText().isEmpty()) {
MageFrame.getInstance().showError("Please enter an email address.");
return;
}
@ -275,15 +275,15 @@ public class ResetPasswordDialog extends MageDialog {
}//GEN-LAST:event_btnGetAuthTokenActionPerformed
private void btnSubmitNewPasswordActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSubmitNewPasswordActionPerformed
if (this.txtEmail.getText().length() == 0) {
if (this.txtEmail.getText().isEmpty()) {
MageFrame.getInstance().showError("Please enter an email address.");
return;
}
if (this.txtAuthToken.getText().length() == 0) {
if (this.txtAuthToken.getText().isEmpty()) {
MageFrame.getInstance().showError("Please enter an auth token.");
return;
}
if (this.txtPassword.getText().length() == 0) {
if (this.txtPassword.getText().isEmpty()) {
MageFrame.getInstance().showError("Please enter a new password.");
return;
}

View file

@ -166,7 +166,7 @@ public class TournamentPlayerPanel extends javax.swing.JPanel {
private void cbPlayerTypeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbPlayerTypeActionPerformed
if (!this.cbPlayerType.getSelectedItem().equals("Human")) {
this.pnlPlayerName.setVisible(true);
if (this.txtPlayerName.getText().length() == 0) {
if (this.txtPlayerName.getText().isEmpty()) {
this.txtPlayerName.setText("Computer " + this.lblPlayerNum.getText());
}
}

View file

@ -153,7 +153,7 @@ public class GlowText extends JLabel {
@Override
public void paint(Graphics g) {
if (getText().length() == 0) {
if (getText().isEmpty()) {
return;
}

View file

@ -217,7 +217,7 @@ public class ManaSymbols {
loadSymbolsImages(symbolWidth);
}
Map<String, BufferedImage> sizedSymbols = manaImages.get(symbolWidth);
if (manaCost.length() == 0) {
if (manaCost.isEmpty()) {
return;
}
manaCost = manaCost.replace("\\", "");

View file

@ -98,7 +98,7 @@ public class DownloadPictures extends DefaultBoundedRangeModel implements Runnab
ArrayList<CardDownloadData> cards = getNeededCards(allCards);
/*
* if (cards == null || cards.size() == 0) {
* if (cards == null || cards.isEmpty()) {
* JOptionPane.showMessageDialog(null,
* "All card pictures have been downloaded."); return; }
*/