List<PatternTypeTestDescription> (@NotNull List<PsiEnumConstant> constants) { List<PatternTypeTestDescription> reducedToTypeTest = new ArrayList<>(); Map<PsiType, List<PsiEnumConstant>> enumsByTypes = constants.stream().collect(Collectors.groupingBy(t -> t.getType())); for (Map.Entry<PsiType, List<PsiEnumConstant>> entry : enumsByTypes.entrySet()) { PsiClass enumClass = PsiUtil.resolveClassInClassTypeOnly(entry.getKey()); if (enumClass == null) { continue; } if (SwitchBlockHighlightingModel.findMissingEnumConstant(enumClass, entry.getValue()).isEmpty()) { reducedToTypeTest.add(new PatternTypeTestDescription(entry.getKey())); } } return reducedToTypeTest; }