String (boolean trimIfNeeded) { if (myMissingPropertyIssues.size() == 1) { MissingPropertyIssueData prop = myMissingPropertyIssues.iterator().next(); return JsonBundle.message("schema.validation.property", getPropertyNameWithComment(prop)); } Collection<MissingPropertyIssueData> namesToDisplay = myMissingPropertyIssues; boolean trimmed = false; if (trimIfNeeded && namesToDisplay.size() > 3) { namesToDisplay = new ArrayList<>(); Iterator<MissingPropertyIssueData> iterator = myMissingPropertyIssues.iterator(); for (int i = 0; i < 3; i++) { namesToDisplay.add(iterator.next()); } trimmed = true; } String allNames = myMissingPropertyIssues.stream().map( MissingMultiplePropsIssueData::getPropertyNameWithComment).sorted((s1, s2) -> { boolean firstHasEq = s1.contains("="); boolean secondHasEq = s2.contains("="); if (firstHasEq == secondHasEq) { return s1.compareTo(s2); } return firstHasEq ? -1 : 1; }).collect(Collectors.joining(", ")); if (trimmed) allNames += ", ..."; return JsonBundle.message("schema.validation.properties", allNames); }