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

Method tryFind

corpus/java/training/guava/collect/Iterables.java:654–656  ·  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

652 * @since 11.0
653 */
654 public static <T> Optional<T> tryFind(Iterable<T> iterable, Predicate<? super T> predicate) {
655 return Iterators.tryFind(iterable.iterator(), predicate);
656 }
657
658 /**
659 * 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