List<JavaArrangementOverriddenMethodsInfo> () { List<JavaArrangementOverriddenMethodsInfo> result = new ArrayList<>(); for (Map.Entry<PsiClass, List<OverriddenMethodPair>> entry: myOverriddenMethods.entrySet()) { String name = entry.getKey().getName(); Map<PsiClass, List<OverriddenMethodPair>> groupedByClass = entry.getValue().stream() .collect(Collectors.groupingBy(pair -> pair.overriding.getContainingClass())); for (Map.Entry<PsiClass, List<OverriddenMethodPair>> listEntry: groupedByClass.entrySet()) { JavaArrangementOverriddenMethodsInfo info = new JavaArrangementOverriddenMethodsInfo(name); result.add(info); List<OverriddenMethodPair> value = listEntry.getValue(); value.sort(Comparator.comparingInt(pair -> pair.overridden.getTextOffset())); for (OverriddenMethodPair methodPair: value) { JavaElementArrangementEntry methodEntry = myMethodEntriesMap.get(methodPair.overriding); info.addMethodEntry(methodEntry); } } } return result; }