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)
| 308 | |
| 309 | |
| 310 | public static <T> T getOnlyElement(Iterable<T> iterable) { |
| 311 | return Iterators.getOnlyElement(iterable.iterator()); |
| 312 | } |
| 313 | |
| 314 | /** |
| 315 | * Returns the single element contained in {@code iterable}, or {@code |
no test coverage detected