CallHandler<CallChainSimplification> () { return CallHandler.of(STREAM_FOR_EACH, call -> { PsiMethodCallExpression qualifierCall = getQualifierMethodCall(call); if (qualifierCall == null || ExpressionUtils.getEffectiveQualifier(qualifierCall.getMethodExpression()) == null) return null; if (COLLECTION_STREAM.test(qualifierCall)) { return new ReplaceForEachMethodFix(call.getMethodExpression().getReferenceName(), FOR_EACH_METHOD, true); } if (OPTIONAL_STREAM.test(qualifierCall)) { return new ReplaceForEachMethodFix(call.getMethodExpression().getReferenceName(), IF_PRESENT_METHOD, false); } return null; }); }