int (@NotNull FileTypeAssociationForm.MyFileTypeItem item) { if (mySuperType != item.mySuperType) { String d1 = mySuperType != null ? mySuperType.getDescription() : myFileType.getDescription(); String d2 = item.mySuperType != null ? item.mySuperType.getDescription() : item.myFileType.getDescription(); return d1.compareTo(d2); } int subtypePriority = Boolean.compare(isMainSubtype(), item.isMainSubtype()); if (subtypePriority != 0) return -subtypePriority; return myFileType.getDescription().compareTo(item.myFileType.getDescription()); }