Replaced zero equality checks with isEmpty() method.

This commit is contained in:
MobiusDev
2018-09-09 17:26:21 +00:00
parent 96a39e7b73
commit 10be587e80
63 changed files with 116 additions and 116 deletions

View File

@@ -368,7 +368,7 @@ public final class PetitionManager
final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
if (_pendingPetitions.size() == 0)
if (_pendingPetitions.isEmpty())
{
htmlContent.append("<tr><td>There are no currently pending petitions.</td></tr>");
}

View File

@@ -278,7 +278,7 @@ public class CronParser
public static void parseLine(TaskTable table, String line) throws Exception
{
line = line.trim();
if ((line.length() == 0) || (line.charAt(0) == '#'))
if ((line.isEmpty()) || (line.charAt(0) == '#'))
{
return;
}
@@ -436,7 +436,7 @@ public class CronParser
{
// Java inner-process.
String className = command.substring(5);
if (className.length() == 0)
if (className.isEmpty())
{
throw new Exception("Invalid Java class name on line: " + line);
}
@@ -450,7 +450,7 @@ public class CronParser
{
methodName = className.substring(sep + 1);
className = className.substring(0, sep);
if (methodName.length() == 0)
if (methodName.isEmpty())
{
throw new Exception("Invalid Java method name on line: " + line);
}

View File

@@ -44,7 +44,7 @@ public class ExpressionBuilder
*/
public ExpressionBuilder(String expression)
{
if ((expression == null) || (expression.trim().length() == 0))
if ((expression == null) || (expression.trim().isEmpty()))
{
throw new IllegalArgumentException("Expression can not be empty");
}
@@ -190,7 +190,7 @@ public class ExpressionBuilder
*/
public Expression build()
{
if (expression.length() == 0)
if (expression.isEmpty())
{
throw new IllegalArgumentException("The expression can not be empty");
}

View File

@@ -64,7 +64,7 @@ public class SQLAccountManager
if (_mode.equals("1") || _mode.equals("2") || _mode.equals("3"))
{
while (_uname.trim().length() == 0)
while (_uname.trim().isEmpty())
{
System.out.print("Username: ");
_uname = _scn.next().toLowerCase();
@@ -72,7 +72,7 @@ public class SQLAccountManager
if (_mode.equals("1"))
{
while (_pass.trim().length() == 0)
while (_pass.trim().isEmpty())
{
System.out.print("Password: ");
_pass = _scn.next();
@@ -81,7 +81,7 @@ public class SQLAccountManager
if (_mode.equals("1") || _mode.equals("2"))
{
while (_level.trim().length() == 0)
while (_level.trim().isEmpty())
{
System.out.print("Access level: ");
_level = _scn.next();

View File

@@ -39,7 +39,7 @@ public class GameServerRegister extends BaseGameServerRegister
{
load();
if (GameServerTable.getInstance().getServerNames().size() == 0)
if (GameServerTable.getInstance().getServerNames().isEmpty())
{
System.out.println("No available names for GameServer, verify servername.xml file exists in the LoginServer folder.");
System.exit(1);