@NotNull
  private static Collection<BuildParticipant> excludeTransitiveParentsOf(@NotNull String path, @NotNull List<BuildParticipant> participants) {
    Map<String, BuildParticipant> rootPathParticipantMap = new LinkedHashMap<>();

    for (BuildParticipant participant : participants) {
      rootPathParticipantMap.put(participant.getRootPath(), participant);
    }

    String currentPath = path;
    while (currentPath != null) {
      BuildParticipant removed = rootPathParticipantMap.remove(currentPath);
      currentPath = removed != null ? removed.getParentRootPath() : null;
    }

    return rootPathParticipantMap.values();
  }
@NotNull
  private static Collection<BuildParticipant> excludeTransitiveParentsOf(@NotNull String path, @NotNull List<BuildParticipant> participants)