List of utility methods to do Iterable First
T | firstOrNull(Iterable first Or Null return firstOrNull(iterable.iterator());
|
T | getFirst(final Iterable extends T> iterable) Gets the first element from an iterable. if (iterable == null) { return null; final Iterator<? extends T> iterator = iterable.iterator(); if (iterator.hasNext()) { return iterator.next(); } else { return null; ... |
T | getFirst(final Iterable get First if (iterable == null) { return null; final Iterator<T> iterator = iterable.iterator(); if (iterator == null) { return null; return iterator.hasNext() ? iterator.next() : null; ... |
T | getFirst(Iterable extends T> iterable) Return the first element in the given (non-empty) Iterable if (iterable instanceof List) { final List<T> list = (List<T>) iterable; if (list.isEmpty()) throw new NoSuchElementException(); return list.get(0); } else { return iterable.iterator().next(); |
Object | getFirst(Iterable get First final Iterator<T> it = c.iterator(); if (!it.hasNext()) { return null; } else { return it.next(); |
T | getFirst(Iterable Method description T result = null; if (iterable != null) { result = getFirst(iterable.iterator()); return result; |
T | getFirst(Iterable Returns the first element from the given Iterable . try { if (iterable != null) { Iterator<T> iter = iterable.iterator(); return iter.next(); } else { return null; } catch (NoSuchElementException e) { ... |
T | getFirst(Iterable get First return getFirst(iterable, null);
|
T | getFirst(Iterable get First Iterator<T> iterator = iterable.iterator();
return iterator.hasNext() ? iterator.next() : defaultValue;
|
Object | getFirstElement(Object maybeIterable) Returns the first element, if any, of an object that may be an Iterable if (!(maybeIterable instanceof Iterable<?>)) return null; Iterable<?> iterable = (Iterable<?>) maybeIterable; Iterator<?> iterator = iterable.iterator(); return iterator.hasNext() ? iterator.next() : null; |