class IssueAggregation {

  @Nonnull
  @VisibleForTesting
  static Map<Warning, SortedSet<String>> aggregateDuplicateWarnings(
      Map<String, Warnings> nodeToWarnings, Function<Warnings, List<Warning>> warningFunc) {
    Map<Warning, SortedSet<String>> map = new HashMap<>();
    nodeToWarnings.forEach(
        (node, warnings) -> {
          for (Warning warning : warningFunc.apply(warnings)) {
            map.computeIfAbsent(warning, w -> new TreeSet<>()).add(node);
          }
        });
    return map;
  }

}