void (@NotNull BiConsumer<GradleModelFetchPhase, List<ProjectImportModelProvider>> consumer) { myModelProviders.stream() .collect(Collectors.groupingBy(it -> it.getPhase())).entrySet().stream() .sorted(Map.Entry.comparingByKey()) .forEachOrdered(it -> consumer.accept(it.getKey(), it.getValue())); }