List<IntentionActionMetaData> (@NotNull List<IntentionActionMetaData> intentionsToShow) { List<IntentionActionMetaData> copy = new ArrayList<>(intentionsToShow); copy.sort((data1, data2) -> { String[] category1 = data1.myCategory; String[] category2 = data2.myCategory; int result = ArrayUtil.lexicographicCompare(category1, category2); if (result != 0) { return result; } return data1.getFamily().compareTo(data2.getFamily()); }); return copy; }