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

Method tryFind

output/java_guava/1.4.19/Iterables.java:706–708  ·  view source on GitHub ↗

Returns an Optional containing the first element in iterable that satisfies the given predicate, if such an element exists. Warning: avoid using a predicate that matches null. If null is matched in iterable, a NullPointerException will be th

(Iterable<T> iterable, Predicate<? super T> predicate)

Source from the content-addressed store, hash-verified

704
705
706 public static <T> Optional<T> tryFind(Iterable<T> iterable, Predicate<? super T> predicate) {
707 return Iterators.tryFind(iterable.iterator(), predicate);
708 }
709
710 /**
711 * Returns the index in {@code iterable} of the first element that satisfies

Callers 1

firstMatchMethod · 0.95

Calls 2

tryFindMethod · 0.95
iteratorMethod · 0.65

Tested by

no test coverage detected