Skip to content

Commit

Permalink
Add isEmpty method to JsonArray class (#1640)
Browse files Browse the repository at this point in the history
The method will return true if the array is empty and false if it's not
  • Loading branch information
GabrielBB committed Mar 2, 2020
1 parent 360cd3e commit fa94721
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions gson/src/main/java/com/google/gson/JsonArray.java
Expand Up @@ -171,6 +171,15 @@ public boolean contains(JsonElement element) {
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,
Expand Down

0 comments on commit fa94721

Please sign in to comment.