void (@NotNull Project project, @NotNull PsiMethodCallExpression call) { PsiType type = call.getType(); PsiType elementType = PsiUtil.substituteTypeParameter(type, CommonClassNames.JAVA_UTIL_ITERATOR, 0, false); elementType = GenericsUtil.getVariableTypeByExpressionType(elementType); String replacement = CommonClassNames.JAVA_UTIL_COLLECTIONS + "." + (elementType == null ? "" : "<" + elementType.getCanonicalText() + ">") + "emptyIterator()"; PsiElement result = new CommentTracker().replaceAndRestoreComments(call, replacement); RemoveRedundantTypeArgumentsUtil.removeRedundantTypeArguments(result); JavaCodeStyleManager.getInstance(project).shortenClassReferences(result); }