Merge pull request #7659 from Nightfirecat/isempty
client: Use isEmpty() for all Collection emptiness checks
This commit is contained in:
@@ -126,7 +126,7 @@ public class ChatboxInputManager
|
||||
isDone = true;
|
||||
break;
|
||||
case '\b':
|
||||
if (str.length() > 0)
|
||||
if (!str.isEmpty())
|
||||
{
|
||||
str = str.substring(0, str.length() - 1);
|
||||
}
|
||||
|
||||
@@ -274,7 +274,7 @@ public class ChatboxTextInput extends ChatboxInput implements KeyListener, Mouse
|
||||
leftText.setOriginalHeight(h);
|
||||
leftText.revalidate();
|
||||
|
||||
if (mt.length() > 0)
|
||||
if (!mt.isEmpty())
|
||||
{
|
||||
cursor.setTextColor(0x113399);
|
||||
}
|
||||
|
||||
@@ -274,7 +274,7 @@ public class DiaryRequirementsPlugin extends Plugin
|
||||
StringBuilder b = new StringBuilder();
|
||||
b.append("<col=ffffff>(");
|
||||
|
||||
assert req.getRequirements().size() > 0;
|
||||
assert !req.getRequirements().isEmpty();
|
||||
for (Requirement ireq : req.getRequirements())
|
||||
{
|
||||
boolean satifisfied = satisfiesRequirement(ireq);
|
||||
|
||||
@@ -284,7 +284,7 @@ public class HotColdClue extends ClueScroll implements LocationClueScroll, Locat
|
||||
{
|
||||
this.location = null;
|
||||
|
||||
if (digLocations.size() == 0)
|
||||
if (digLocations.isEmpty())
|
||||
{
|
||||
digLocations.addAll(Arrays.asList(HotColdLocation.values()));
|
||||
}
|
||||
|
||||
@@ -159,7 +159,7 @@ public class DemonicGorillaPlugin extends Plugin
|
||||
final DemonicGorilla.AttackStyle... protectedStyles)
|
||||
{
|
||||
if (gorilla.getAttacksUntilSwitch() <= 0 ||
|
||||
gorilla.getNextPosibleAttackStyles().size() == 0)
|
||||
gorilla.getNextPosibleAttackStyles().isEmpty())
|
||||
{
|
||||
gorilla.setNextPosibleAttackStyles(Arrays
|
||||
.stream(DemonicGorilla.ALL_REGULAR_ATTACK_STYLES)
|
||||
@@ -259,7 +259,7 @@ public class DemonicGorillaPlugin extends Plugin
|
||||
.filter(x -> x == attackStyle)
|
||||
.collect(Collectors.toList()));
|
||||
|
||||
if (gorilla.getNextPosibleAttackStyles().size() == 0)
|
||||
if (gorilla.getNextPosibleAttackStyles().isEmpty())
|
||||
{
|
||||
// Sometimes the gorilla can switch attack style before it's supposed to
|
||||
// if someone was fighting it earlier and then left, so we just
|
||||
@@ -381,7 +381,7 @@ public class DemonicGorillaPlugin extends Plugin
|
||||
// so we assume it was the gorilla who shot it
|
||||
onGorillaAttack(gorilla, DemonicGorilla.AttackStyle.BOULDER);
|
||||
}
|
||||
else if (mp.getRecentHitsplats().size() > 0)
|
||||
else if (!mp.getRecentHitsplats().isEmpty())
|
||||
{
|
||||
// It wasn't any of the three other attacks,
|
||||
// but the player took damage, so we assume
|
||||
@@ -581,7 +581,7 @@ public class DemonicGorillaPlugin extends Plugin
|
||||
// Player went out of memory, so assume the hit was a 0
|
||||
shouldDecreaseCounter = true;
|
||||
}
|
||||
else if (target.getRecentHitsplats().size() == 0)
|
||||
else if (target.getRecentHitsplats().isEmpty())
|
||||
{
|
||||
// No hitsplats was applied. This may happen in some cases
|
||||
// where the player was out of memory while the
|
||||
|
||||
@@ -278,7 +278,7 @@ class WidgetInspector extends JFrame
|
||||
|
||||
static WidgetInfo getWidgetInfo(int packedId)
|
||||
{
|
||||
if (widgetIdMap.size() == 0)
|
||||
if (widgetIdMap.isEmpty())
|
||||
{
|
||||
//Initialize map here so it doesn't create the index
|
||||
//until it's actually needed.
|
||||
|
||||
@@ -302,7 +302,7 @@ public class FairyRingPlugin extends Plugin
|
||||
String code = Text.removeTags(c.getDescription().getName()).replaceAll(" ", "");
|
||||
String tags = null;
|
||||
|
||||
if (code.length() > 0)
|
||||
if (!code.isEmpty())
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
@@ -133,7 +133,7 @@ class KourendLibraryOverlay extends Overlay
|
||||
Color color = bookIsKnown ? Color.ORANGE : Color.WHITE;
|
||||
|
||||
// Render the poly on the floor
|
||||
if (!(bookIsKnown && book == null) && (library.getState() == SolvedState.NO_DATA || book != null || possible.size() > 0))
|
||||
if (!(bookIsKnown && book == null) && (library.getState() == SolvedState.NO_DATA || book != null || !possible.isEmpty()))
|
||||
{
|
||||
Polygon poly = getCanvasTilePoly(client, localBookcase);
|
||||
if (poly != null)
|
||||
|
||||
Reference in New Issue
Block a user