int (@NotNull List<? extends PsiStatement> statements, @NotNull Predicate<? super PsiStatement> predicate) { int index = -1; for (int i = 0; i < statements.size(); i++) { PsiStatement statement = statements.get(i); if (!predicate.test(statement)) continue; if (index != -1) return -1; index = i; } return index; }