MCPcopy Create free account
hub / github.com/antlr/codebuff / getOnlyElement

Method getOnlyElement

corpus/java/training/guava/collect/Iterables.java:296–298  ·  view source on GitHub ↗

Returns the single element contained in iterable. @throws NoSuchElementException if the iterable is empty @throws IllegalArgumentException if the iterable contains multiple elements

(Iterable<T> iterable)

Source from the content-addressed store, hash-verified

294 * elements
295 */
296 public static <T> T getOnlyElement(Iterable<T> iterable) {
297 return Iterators.getOnlyElement(iterable.iterator());
298 }
299
300 /**
301 * Returns the single element contained in {@code iterable}, or {@code

Callers 5

asImmutableMethod · 0.95
asImmutableMethod · 0.95
copyOfMethod · 0.95
buildMethod · 0.95
charsetMethod · 0.95

Calls 2

getOnlyElementMethod · 0.95
iteratorMethod · 0.65

Tested by

no test coverage detected