Add isEmpty method to JsonArray class (#1640)

The method will return true if the array is empty and false if it's not
This commit is contained in:
Gabriel Basilio Brito 2020-03-02 18:52:37 -04:00 committed by GitHub
parent 360cd3e2da
commit fa947212e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -171,6 +171,15 @@ public final class JsonArray extends JsonElement implements Iterable<JsonElement
public int size() {
return elements.size();
}
/**
* Returns true if the array is empty
*
* @return true if the array is empty
*/
public boolean isEmpty() {
return elements.isEmpty();
}
/**
* Returns an iterator to navigate the elements of the array. Since the array is an ordered list,