Skip to content

Commit

Permalink
minor cleaning (isEmpty usage)
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Feb 4, 2020
1 parent 60ea121 commit 3cf6a13
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,7 @@ public String Get(YamlConfiguration yaml, int index, String key, String def) {
if (index > list.size()) {
index = list.size() - 1;
}
if (list.size() == 0) {
if (list.isEmpty()) {
return "";
}
return list.get(index);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ else if (next != null && next.asBoolean()) {
}
else if (callback != null && callback.asBoolean()) {
if (scriptEntry.getOwner() != null && (scriptEntry.getOwner().getCommandName().equalsIgnoreCase("foreach") ||
scriptEntry.getOwner().getBracedSet() == null || scriptEntry.getOwner().getBracedSet().size() == 0 ||
scriptEntry.getOwner().getBracedSet() == null || scriptEntry.getOwner().getBracedSet().isEmpty() ||
scriptEntry.getBracedSet().get(0).value.get(scriptEntry.getBracedSet().get(0).value.size() - 1) != scriptEntry)) {
ForeachData data = (ForeachData) scriptEntry.getOwner().getData();
data.index++;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ public void execute(ScriptEntry scriptEntry) {
Debug.log("Trying: " + braceSet.key);
}
List<String> key = braceSet.args;
if (key.size() == 0 || !key.get(0).equalsIgnoreCase("else")) {
if (key.isEmpty() || !key.get(0).equalsIgnoreCase("else")) {
Debug.echoError("If command has argument '" + key.get(0) + "' which is unknown.");
continue;
}
Expand Down Expand Up @@ -420,7 +420,7 @@ public boolean compareInternal() {
if (Debug.verbose) {
Debug.log("Comparing " + args);
}
if (args.size() == 0) {
if (args.isEmpty()) {
if (Debug.verbose) {
Debug.log("Args.size == 0, return false");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ else if (next != null && next.asBoolean()) {
}
else if (callback != null && callback.asBoolean()) {
if (scriptEntry.getOwner() != null && (scriptEntry.getOwner().getCommandName().equalsIgnoreCase("repeat") ||
scriptEntry.getOwner().getBracedSet() == null || scriptEntry.getOwner().getBracedSet().size() == 0 ||
scriptEntry.getOwner().getBracedSet() == null || scriptEntry.getOwner().getBracedSet().isEmpty() ||
scriptEntry.getBracedSet().get(0).value.get(scriptEntry.getBracedSet().get(0).value.size() - 1) != scriptEntry)) {
RepeatData data = (RepeatData) scriptEntry.getOwner().getData();
data.index++;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ else if (next != null && next.asBoolean()) {
}
else if (callback != null && callback.asBoolean()) {
if (scriptEntry.getOwner() != null && (scriptEntry.getOwner().getCommandName().equalsIgnoreCase("while") ||
scriptEntry.getOwner().getBracedSet() == null || scriptEntry.getOwner().getBracedSet().size() == 0 ||
scriptEntry.getOwner().getBracedSet() == null || scriptEntry.getOwner().getBracedSet().isEmpty() ||
scriptEntry.getBracedSet().get(0).value.get(scriptEntry.getBracedSet().get(0).value.size() - 1) != scriptEntry)) {
WhileData data = (WhileData) scriptEntry.getOwner().getData();
data.index++;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ public ScriptEntrySet getSetFor(String path) {
return got;
}
List<Object> stringEntries = contents.getList(path);
if (stringEntries == null || stringEntries.size() == 0) {
if (stringEntries == null || stringEntries.isEmpty()) {
return null;
}
List<ScriptEntry> entries = ScriptBuilder.buildScriptEntries(stringEntries, this, null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ public static ObjectTag parseChainObject(List<ParseableTagPiece> pieces, TagCont
}
}
if (pieces.size() < 2) {
if (pieces.size() == 0) {
if (pieces.isEmpty()) {
return new ElementTag("");
}
ParseableTagPiece pzero = pieces.get(0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ void emptyEmptyMaps(List<String> parts) {
return;
}
else if (oPortion instanceof Map) {
if (((Map<StringHolder, Object>) oPortion).size() == 0) {
if (((Map<StringHolder, Object>) oPortion).isEmpty()) {
portion.remove(new StringHolder(parts.get(i)));
emptyEmptyMaps(parts);
return;
Expand Down

0 comments on commit 3cf6a13

Please sign in to comment.