RedundantCollectionOperationHandler (PsiMethodCallExpression call) { PsiMethodCallExpression qualifierCall = MethodCallUtils.getQualifierMethodCall(call); String replacementMethod; if (MAP_KEY_SET.test(qualifierCall)) { replacementMethod = "containsKey"; } else if (MAP_VALUES.test(qualifierCall)) { replacementMethod = "containsValue"; } else { return null; } PsiExpression mapExpression = qualifierCall.getMethodExpression().getQualifierExpression(); if (mapExpression == null) return null; return new MapKeySetContainsHandler(replacementMethod); }