Use of isEmpty method when possible.
This commit is contained in:
@@ -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())
|
||||
{
|
||||
|
@@ -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))
|
||||
|
@@ -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)
|
||||
|
@@ -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))
|
||||
{
|
||||
|
@@ -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);
|
||||
|
Reference in New Issue
Block a user