Refractoring and Cleanup

Optimized some of the code where possible and removed some magic numbers as well.
This commit is contained in:
Matt
2016-02-13 20:01:18 -05:00
parent a1eec4eb0c
commit fde845e1d8
121 changed files with 5462 additions and 5803 deletions

View File

@ -360,7 +360,7 @@ public class JSONObject {
}
public static Writer quote(final String string, final Writer w) throws IOException {
if ((string == null) || (string.length() == 0)) {
if ((string == null) || (string.isEmpty())) {
w.write("\"\"");
return w;
}
@ -1111,7 +1111,7 @@ public class JSONObject {
} else if (name.startsWith("is")) {
key = name.substring(2);
}
if ((key.length() > 0) && Character.isUpperCase(key.charAt(0)) && (method.getParameterTypes().length == 0)) {
if ((!key.isEmpty()) && Character.isUpperCase(key.charAt(0)) && (method.getParameterTypes().length == 0)) {
if (key.length() == 1) {
key = key.toLowerCase();
} else if (!Character.isUpperCase(key.charAt(1))) {