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

Method first

output/java_guava/1.4.17/FluentIterable.java:522–525  ·  view source on GitHub ↗

Returns an Optional containing the first element in this fluent iterable. If the iterable is empty, Optional.absent() is returned. Stream equivalent: if the goal is to obtain any element, stream.findAny(); if it must specifically be the first element

()

Source from the content-addressed store, hash-verified

520
521
522 public final Optional<E> first() {
523 Iterator<E> iterator = iterable.iterator();
524 return iterator.hasNext() ? Optional.of(iterator.next()) : Optional.<E>absent();
525 }
526
527 /**
528 * Returns an {@link Optional} containing the last element in this fluent iterable. If the

Callers

nothing calls this directly

Calls 5

ofMethod · 0.95
absentMethod · 0.95
iteratorMethod · 0.65
nextMethod · 0.65
hasNextMethod · 0.45

Tested by

no test coverage detected