boolean (@Nullable PsiElement element, Predicate<? super PsiMethodCallExpression> predicate) { if(element == null) return false; final boolean[] result = new boolean[1]; element.accept(new JavaRecursiveElementWalkingVisitor() { @Override public void visitMethodCallExpression(@NotNull PsiMethodCallExpression expression) { super.visitMethodCallExpression(expression); if (predicate.test(expression)) { result[0] = true; stopWalking(); } } }); return result[0]; }