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

Method indexOf

output/java_guava/1.4.18/Iterators.java:770–779  ·  view source on GitHub ↗

Returns the index in iterator of the first element that satisfies the provided predicate, or -1 if the Iterator has no such elements. More formally, returns the lowest index i such that predicate.apply(Iterators.get(iterator, i)) returns true, or {

(Iterator<T> iterator, Predicate<? super T> predicate)

Source from the content-addressed store, hash-verified

768
769
770 public static <T> int indexOf(Iterator<T> iterator, Predicate<? super T> predicate) {
771 checkNotNull(predicate, "predicate");
772 for (int i = 0; iterator.hasNext(); i++) {
773 T current = iterator.next();
774 if (predicate.apply(current)) {
775 return i;
776 }
777 }
778 return -1;
779 }
780
781 /**
782 * Returns a view containing the result of applying {@code function} to each

Callers 2

indexOfMethod · 0.95
anyMethod · 0.95

Calls 4

nextMethod · 0.65
applyMethod · 0.65
checkNotNullMethod · 0.45
hasNextMethod · 0.45

Tested by

no test coverage detected