list.size > 0 changed to !list.isEmpty

We care about if it's empty or not, not about it's size
This commit is contained in:
vraskulin 2017-01-27 16:04:56 +03:00
parent f60ebfbb1f
commit 0557b5e89c
366 changed files with 532 additions and 548 deletions

View file

@ -86,7 +86,7 @@ public class ImageHelper {
}
public static void drawCosts(List<String> costs, Graphics2D g, int xOffset, int yOffset, ImageObserver o) {
if (costs.size() > 0) {
if (!costs.isEmpty()) {
int costLeft = xOffset;
for (int i = costs.size() - 1; i >= 0; i--) {
String symbol = costs.get(i);

View file

@ -49,7 +49,7 @@ public class MageTableRowSorter extends TableRowSorter<TableModel> {
@Override
public void toggleSortOrder(int column) {
List<? extends SortKey> sortKeys = getSortKeys();
if (sortKeys.size() > 0) {
if (!sortKeys.isEmpty()) {
if (sortKeys.get(0).getSortOrder() == SortOrder.DESCENDING) {
setSortKeys(null);
return;

View file

@ -135,7 +135,7 @@ public class ArrowBuilder {
if (map.containsKey(gameId)) {
Map<Type, List<Arrow>> innerMap = map.get(gameId);
java.util.List<Arrow> arrows = innerMap.get(type);
if (arrows != null && arrows.size() > 0) {
if (arrows != null && !arrows.isEmpty()) {
JPanel p = getArrowsPanel(gameId);
synchronized (map) {
for (Arrow arrow : arrows) {

View file

@ -330,7 +330,7 @@ public class GuiDisplayUtil {
}
}
}
if (textLines.lines.size() > 0) {
if (!textLines.lines.isEmpty()) {
for (String textLine : textLines.lines) {
if (textLine != null && !textLine.replace(".", "").trim().isEmpty()) {
rule.append("<p style='margin: 2px'>").append(textLine).append("</p>");
@ -339,7 +339,7 @@ public class GuiDisplayUtil {
}
String legal = rule.toString();
if (legal.length() > 0) {
if (!legal.isEmpty()) {
legal = legal.replaceAll("\\{this\\}", card.getName().isEmpty() ? "this" : card.getName());
legal = legal.replaceAll("\\{source\\}", card.getName().isEmpty() ? "this" : card.getName());
buffer.append(ManaSymbols.replaceSymbolsWithHTML(legal, ManaSymbols.Type.TOOLTIP));
@ -366,7 +366,7 @@ public class GuiDisplayUtil {
for (CardType cardType : card.getCardTypes()) {
types += cardType.toString() + ' ';
}
if (card.getSubTypes().size() > 0) {
if (!card.getSubTypes().isEmpty()) {
types += "- ";
}
for (String subType : card.getSubTypes()) {

View file

@ -36,7 +36,7 @@ public class UpdateMemUsageTask extends SwingWorker<Void, Float> {
@Override
protected void process(List<Float> chunks) {
if (chunks != null && chunks.size() > 0) {
if (chunks != null && !chunks.isEmpty()) {
Float memUsage = chunks.get(chunks.size() - 1);
if (memUsage != null) {
jLabelToDisplayInfo.setText(Math.round(memUsage) + "% Mem free");