mirror of
https://github.com/fankes/JSON-java-compat.git
synced 2025-09-08 19:44:29 +08:00
change length comparison to isEmpty method
This commit is contained in:
6
CDL.java
6
CDL.java
@@ -224,7 +224,7 @@ public class CDL {
|
||||
*/
|
||||
public static JSONArray toJSONArray(JSONArray names, JSONTokener x)
|
||||
throws JSONException {
|
||||
if (names == null || names.length() == 0) {
|
||||
if (names == null || names.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
JSONArray ja = new JSONArray();
|
||||
@@ -235,7 +235,7 @@ public class CDL {
|
||||
}
|
||||
ja.put(jo);
|
||||
}
|
||||
if (ja.length() == 0) {
|
||||
if (ja.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
return ja;
|
||||
@@ -272,7 +272,7 @@ public class CDL {
|
||||
*/
|
||||
public static String toString(JSONArray names, JSONArray ja)
|
||||
throws JSONException {
|
||||
if (names == null || names.length() == 0) {
|
||||
if (names == null || names.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
StringBuffer sb = new StringBuffer();
|
||||
|
Reference in New Issue
Block a user