Use .isEmpty() where feasible
See gh-38739
This commit is contained in:
committed by
Phillip Webb
parent
d3af5cce73
commit
ac18e3015c
@@ -173,7 +173,7 @@ public class JSONStringer {
|
||||
* @throws JSONException if processing of json failed
|
||||
*/
|
||||
JSONStringer open(Scope empty, String openBracket) throws JSONException {
|
||||
if (this.stack.isEmpty() && this.out.length() > 0) {
|
||||
if (this.stack.isEmpty() && !this.out.isEmpty()) {
|
||||
throw new JSONException("Nesting problem: multiple top-level roots");
|
||||
}
|
||||
beforeValue();
|
||||
@@ -423,7 +423,7 @@ public class JSONStringer {
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.out.length() == 0 ? null : this.out.toString();
|
||||
return this.out.isEmpty() ? null : this.out.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user