mirror of
https://github.com/ethauvin/JSON-java.git
synced 2025-06-17 07:50:52 -07:00
add isEmpty and isNotEmpty methods
This commit is contained in:
parent
3c1535d724
commit
a490ebdb78
1 changed files with 18 additions and 0 deletions
|
@ -963,6 +963,24 @@ public class JSONObject {
|
||||||
return this.map.size();
|
return this.map.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if JSONObject is empty.
|
||||||
|
*
|
||||||
|
* @return true if JSONObject is empty, otherwise false.
|
||||||
|
*/
|
||||||
|
public boolean isEmpty() {
|
||||||
|
return map.isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if JSONObject is not empty.
|
||||||
|
*
|
||||||
|
* @return true if JSONObject is not empty, otherwise false.
|
||||||
|
*/
|
||||||
|
public boolean isNotEmpty() {
|
||||||
|
return !map.isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Produce a JSONArray containing the names of the elements of this
|
* Produce a JSONArray containing the names of the elements of this
|
||||||
* JSONObject.
|
* JSONObject.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue