RedundantCollectionOperationHandler (PsiMethodCallExpression call, CallMatcher nestedCallMatcher, String replacementMethod) { PsiExpression arg = ArrayUtil.getFirstElement(call.getArgumentList().getExpressions()); if (arg == null) return null; PsiMethodCallExpression nestedCall = tryCast(PsiUtil.skipParenthesizedExprDown(arg), PsiMethodCallExpression.class); if (!nestedCallMatcher.test(nestedCall)) return null; return new ReplaceNestedCallHandler(replacementMethod); }