MCPcopy
hub / github.com/google/gson / getAsSingleElement

Method getAsSingleElement

gson/src/main/java/com/google/gson/JsonArray.java:235–241  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

233 }
234
235 private JsonElement getAsSingleElement() {
236 int size = elements.size();
237 if (size == 1) {
238 return elements.get(0);
239 }
240 throw new IllegalStateException("Array must have size 1, but has size " + size);
241 }
242
243 /**
244 * Convenience method to get this array as a {@link Number} if it contains a single element. This

Callers 12

getAsNumberMethod · 0.95
getAsStringMethod · 0.95
getAsDoubleMethod · 0.95
getAsBigDecimalMethod · 0.95
getAsBigIntegerMethod · 0.95
getAsFloatMethod · 0.95
getAsLongMethod · 0.95
getAsIntMethod · 0.95
getAsByteMethod · 0.95
getAsCharacterMethod · 0.95
getAsShortMethod · 0.95
getAsBooleanMethod · 0.95

Calls 2

getMethod · 0.65
sizeMethod · 0.45

Tested by

no test coverage detected