Use of isEmpty method when possible.

This commit is contained in:
MobiusDevelopment
2021-05-25 02:32:37 +00:00
parent b88e59b956
commit bf4066d68e
141 changed files with 210 additions and 213 deletions

View File

@@ -562,7 +562,7 @@ public abstract class FlagWar extends ClanHallSiegeEngine
@Override
public void onSiegeEnds()
{
if (_data.size() > 0)
if (!_data.isEmpty())
{
for (int clanId : _data.keySet())
{

View File

@@ -476,7 +476,7 @@ public class Attackable extends Npc
final PartyContainer mostDamageParty;
damagingParties.sort(Comparator.comparingLong(c -> c.damage));
mostDamageParty = damagingParties.size() > 0 ? damagingParties.get(0) : null;
mostDamageParty = !damagingParties.isEmpty() ? damagingParties.get(0) : null;
// Manage Base, Quests and Sweep drops of the Attackable
if ((mostDamageParty != null) && (mostDamageParty.damage > maxDamage))

View File

@@ -86,10 +86,10 @@ public class CreatureStat
}
final int id = stat.ordinal();
final Calculator c = _creature.getCalculators()[id];
final Calculator calc = _creature.getCalculators()[id];
// If no Func object found, no modifier is applied
if ((c == null) || (c.size() == 0))
if ((calc == null) || (calc.size() == 0))
{
return value;
}
@@ -106,7 +106,7 @@ public class CreatureStat
}
// Launch the calculation
value = c.calc(_creature, target, skill, value);
value = calc.calc(_creature, target, skill, value);
// avoid some troubles with negative stats (some stats should never be negative)
if (value <= 0)

View File

@@ -121,7 +121,7 @@ public abstract class ClanHallSiegeEngine extends Quest implements Siegable
ps.setInt(1, _hall.getId());
ps.execute();
if (_attackers.size() > 0)
if (!_attackers.isEmpty())
{
try (PreparedStatement insert = con.prepareStatement(SQL_SAVE_ATTACKERS))
{

View File

@@ -43,7 +43,7 @@ public class GmViewQuestInfo implements IClientOutgoingPacket
packet.writeS(_player.getName());
final List<Quest> questList = _player.getAllActiveQuests();
if (questList.size() == 0)
if (questList.isEmpty())
{
packet.writeC(0);
packet.writeH(0);