Returns the first element in iterable or defaultValue if the iterable is empty. The Iterators analog to this method is Iterators#getNext. If no default value is desired (and the caller instead wants a NoSuchElementException to be thrown), it is recommende
(Iterable<? extends T> iterable, @Nullable T defaultValue)
| 810 | */ |
| 811 | |
| 812 | @Nullable |
| 813 | public static <T> T getFirst(Iterable<? extends T> iterable, @Nullable T defaultValue) { |
| 814 | return Iterators.getNext(iterable.iterator(), defaultValue); |
| 815 | } |
| 816 | |
| 817 | /** |
| 818 | * Returns the last element of {@code iterable}. If {@code iterable} is a {@link List} with |
no test coverage detected