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 0de8bd2f70
commit fc54c0156c
366 changed files with 532 additions and 548 deletions

View file

@ -78,7 +78,7 @@ public final class Constants {
public enum SessionState {
DISCONNECTED, CONNECTED, CONNECTING, DISCONNECTING, SERVER_STARTING;
DISCONNECTED, CONNECTED, CONNECTING, DISCONNECTING, SERVER_STARTING
}
public enum Option {

View file

@ -397,7 +397,7 @@ public class CardView extends SimpleCardView {
for (SpellAbility spellAbility : spell.getSpellAbilities()) {
for (UUID modeId : spellAbility.getModes().getSelectedModes()) {
Mode mode = spellAbility.getModes().get(modeId);
if (mode.getTargets().size() > 0) {
if (!mode.getTargets().isEmpty()) {
setTargets(mode.getTargets());
}
}

View file

@ -133,7 +133,7 @@ public class CardsView extends LinkedHashMap<UUID, CardView> {
}
abilityView = new AbilityView(ability, sourceObject.getName(), sourceCardView);
}
if (ability.getTargets().size() > 0) {
if (!ability.getTargets().isEmpty()) {
abilityView.setTargets(ability.getTargets());
} else {
List<UUID> abilityTargets = new ArrayList<>();

View file

@ -45,15 +45,15 @@ public class ChatMessage implements Serializable {
private MessageType messageType;
public enum MessageColor {
BLACK, RED, GREEN, BLUE, ORANGE, YELLOW;
BLACK, RED, GREEN, BLUE, ORANGE, YELLOW
}
public enum MessageType {
USER_INFO, STATUS, GAME, TALK, WHISPER;
USER_INFO, STATUS, GAME, TALK, WHISPER
}
public enum SoundToPlay {
PlayerLeft, PlayerQuitTournament, PlayerSubmittedDeck, PlayerWhispered;
PlayerLeft, PlayerQuitTournament, PlayerSubmittedDeck, PlayerWhispered
}
public ChatMessage(String username, String message, String time, MessageColor color) {

View file

@ -191,7 +191,7 @@ public class GameView implements Serializable {
if (priorityPlayer != null && createdForPlayer != null && createdForPlayerId != null && createdForPlayer.isGameUnderControl()
&& (createdForPlayerId.equals(priorityPlayer.getId()) // player controls the turn
|| createdForPlayer.getPlayersUnderYourControl().contains(priorityPlayer.getId()))) { // player controls active players turn
this.special = state.getSpecialActions().getControlledBy(priorityPlayer.getId(), priorityPlayer.isInPayManaMode()).size() > 0;
this.special = !state.getSpecialActions().getControlledBy(priorityPlayer.getId(), priorityPlayer.isInPayManaMode()).isEmpty();
}
} else {
this.special = false;

View file

@ -143,7 +143,7 @@ public class MatchView implements Serializable {
}
this.players = sb1.toString();
StringBuilder sb2 = new StringBuilder();
if (table.getTournament().getRounds().size() > 0) {
if (!table.getTournament().getRounds().isEmpty()) {
for (TournamentPlayer tPlayer : table.getTournament().getPlayers()) {
sb2.append(tPlayer.getPlayer().getName()).append(": ").append(tPlayer.getResults()).append(' ');
}

View file

@ -72,7 +72,7 @@ public class PermanentView extends CardView {
this.morphed = permanent.isMorphed();
this.manifested = permanent.isManifested();
this.damage = permanent.getDamage();
if (permanent.getAttachments().size() > 0) {
if (!permanent.getAttachments().isEmpty()) {
attachments = new ArrayList<>();
attachments.addAll(permanent.getAttachments());
}

View file

@ -258,7 +258,7 @@ public class PlayerView implements Serializable {
}
public boolean hasAttachments() {
return attachments != null && attachments.size() > 0;
return attachments != null && !attachments.isEmpty();
}
public int getStatesSavedSize() {

View file

@ -101,7 +101,7 @@ public class StackAbilityView extends CardView {
List<String> names = new ArrayList<>();
for (UUID modeId : ability.getModes().getSelectedModes()) {
Mode mode = ability.getModes().get(modeId);
if (mode.getTargets().size() > 0) {
if (!mode.getTargets().isEmpty()) {
setTargets(mode.getTargets());
} else {
List<UUID> targetList = new ArrayList<>();
@ -111,7 +111,7 @@ public class StackAbilityView extends CardView {
targetList.add(((FixedTarget) targetPointer).getTarget());
}
}
if (targetList.size() > 0) {
if (!targetList.isEmpty()) {
overrideTargets(targetList);
for (UUID uuid : targetList) {