List<PsiField> (@NotNull PsiClass containingClass, @NotNull Collection<PsiMember> psiMembers) { final Set<String> existingFieldNames = PsiClassUtil.collectClassFieldsIntern(containingClass).stream().map(PsiField::getName).collect(Collectors.toSet()); final PsiElementFactory psiElementFactory = JavaPsiFacade.getElementFactory(containingClass.getProject()); final PsiClassType classType = psiElementFactory.createType(containingClass); boolean makeUppercased = useUppercasedConstants(containingClass); return psiMembers.stream() .filter(psiMember -> !existingFieldNames.contains(makeFieldNameConstant(psiMember, makeUppercased))) .map(psiField -> { if (containingClass.isEnum()) { return createEnumConstant(psiField, makeUppercased, containingClass, classType); } return createFieldNameConstant(psiField, makeUppercased, containingClass); }).collect(Collectors.toList()); }