class CommunitySetToRegexInputString implements CommunitySetRenderingVisitor<String, CommunitySet> {

  @Override
  public String visitTypesFirstAscendingSpaceSeparated(
      TypesFirstAscendingSpaceSeparated typesFirstAscendingSpaceSeparated, CommunitySet arg) {
    return arg.getCommunities().stream()
        .sorted(TYPES_FIRST_ASCENDING_COMPARATOR)
        .map(
            c ->
                typesFirstAscendingSpaceSeparated
                    .getCommunityRendering()
                    .accept(CommunityToRegexInputString.instance(), c))
        .collect(Collectors.joining(" "));
  }

  private  CommunitySetToRegexInputString();

}