private static <T extends PsiElement> void addStatements(@NotNull List<? super T> vector,
                                                           @NotNull PsiElement element,
                                                           @NotNull Class<? extends T> clazz,
                                                           @NotNull Predicate<? super PsiElement> stopAt) {
    if (PsiTreeUtil.instanceOf(element, clazz)) {
      //noinspection unchecked
      vector.add((T)element);
    }
    else if (!(element instanceof PsiClass) && !(element instanceof PsiLambdaExpression) && !stopAt.test(element)) {
      PsiElement[] children = element.getChildren();
      for (PsiElement child : children) {
        addStatements(vector, child, clazz, stopAt);
      }
    }
  }
private static <T extends PsiElement> void addStatements(@NotNull List<? super T> vector,
                                                           @NotNull PsiElement element,
                                                           @NotNull Class<? extends T> clazz,
                                                           @NotNull Predicate<? super PsiElement> stopAt)