public static MavenArtifactIndex build(@NotNull List<? extends MavenArtifact> dependencies) {
    if (dependencies.isEmpty()) return EMPTY_INDEX;

    Map<String, Map<String, List<MavenArtifact>>> map = new HashMap<>();

    for (MavenArtifact dep : dependencies) {
      String groupId = dep.getGroupId();
      if (groupId == null) continue;

      String artifactId = dep.getArtifactId();
      if (artifactId == null) continue;

      Map<String, List<MavenArtifact>> groupMap = map.get(groupId);
      if (groupMap == null) {
        groupMap = new HashMap<>();
        map.put(groupId, groupMap);
      }

      List<MavenArtifact> artifactList = groupMap.get(artifactId);
      if (artifactList == null) {
        artifactList = new SmartList<>();
        groupMap.put(artifactId, artifactList);
      }

      artifactList.add(dep);
    }

    return new MavenArtifactIndex(map);
  }
public static MavenArtifactIndex build(@NotNull List<? extends MavenArtifact> dependencies)