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

@ -274,7 +274,7 @@ public abstract class AbilityImpl implements Ability {
// if ability can be cast for no mana, clear the mana costs now, because additional mana costs must be paid.
// For Flashback ability can be set X before, so the X costs have to be restored for the flashbacked ability
if (noMana) {
if (this.getManaCostsToPay().getVariableCosts().size() > 0) {
if (!this.getManaCostsToPay().getVariableCosts().isEmpty()) {
int xValue = this.getManaCostsToPay().getX();
this.getManaCostsToPay().clear();
VariableManaCost xCosts = new VariableManaCost();
@ -333,7 +333,7 @@ public abstract class AbilityImpl implements Ability {
}
// Flashback abilities haven't made the choices the underlying spell might need for targeting.
if (!(this instanceof FlashbackAbility)
&& getTargets().size() > 0) {
&& !getTargets().isEmpty()) {
Outcome outcome = getEffects().isEmpty() ? Outcome.Detriment : getEffects().get(0).getOutcome();
if (getTargets().chooseTargets(outcome, this.controllerId, this, noMana, game) == false) {
if ((variableManaCost != null || announceString != null) && !game.isSimulation()) {
@ -740,10 +740,10 @@ public abstract class AbilityImpl implements Ability {
public String getRule(boolean all) {
StringBuilder sbRule = threadLocalBuilder.get();
if (all || this.abilityType != AbilityType.SPELL) {
if (manaCosts.size() > 0) {
if (!manaCosts.isEmpty()) {
sbRule.append(manaCosts.getText());
}
if (costs.size() > 0) {
if (!costs.isEmpty()) {
if (sbRule.length() > 0) {
sbRule.append(',');
}
@ -1038,7 +1038,7 @@ public abstract class AbilityImpl implements Ability {
} else {
half = " right";
}
if (spellAbility.getTargets().size() > 0) {
if (!spellAbility.getTargets().isEmpty()) {
sb.append(half).append(" half targeting ");
for (Target target : spellAbility.getTargets()) {
sb.append(target.getTargetedName(game));
@ -1088,7 +1088,7 @@ public abstract class AbilityImpl implements Ability {
protected String getTargetDescriptionForLog(Targets targets, Game game) {
StringBuilder sb = new StringBuilder(); // threadLocal StringBuilder can't be used because calling method already uses it
if (targets.size() > 0) {
if (!targets.isEmpty()) {
String usedVerb = null;
for (Target target : targets) {
if (!target.getTargets().isEmpty()) {