guava/src/com/google/common/collect/FluentIterable.java
public final Optional<E> first() {
    Iterator<E> iterator = getDelegate().iterator();
    return iterator.hasNext() ? Optional.of(iterator.next()) : Optional.<E>absent();
  }
public final Optional<E> first() {
    Iterator<E> iterator = getDelegate().iterator();
    return iterator.hasNext() ? Optional.of(iterator.next()) : Optional.<E>absent();
  }
Returns an {@link Optional} containing the first element in this fluent iterable. If the
iterable is empty, {@code Optional.absent()} is returned.

<p><b>{@code Stream} equivalent:</b> if the goal is to obtain any element, {@link
Stream#findAny}; if it must specifically be the <i>first</i> element, {@code Stream#findFirst}.

@throws NullPointerException if the first element is null; if this is a possibility, use {@code
iterator().next()} or {@link Iterables#getFirst} instead.