code: static String encode(List<String> eventIds) {
          checkArgument(!eventIds.isEmpty(), "Empty event ID list.");
          if (eventIds.size() == 1) {
              return checkValid(eventIds.get(0));
          }
          // Concatenate the event IDs using a simple scheme that efficiently encodes events that are the same length and
          // share a common prefix.
          StringBuilder buf = new StringBuilder();
          String prevId = null;
          for (String eventId : eventIds) {
              checkValid(eventId);
              int commonPrefixLength;
              if (prevId == null) {
                  // First event ID
                  buf.append(eventId);
              } else if (prevId.length() == eventId.length() &&
                      (commonPrefixLength = getCommonPrefixLength(prevId, eventId)) > 0) {
                  // Event ID is same length and shares a common prefix with the previous.  Just add the part that's different.
                  buf.append(DELIM_SHARED_PREFIX).append(eventId.substring(commonPrefixLength));
              } else {
                  buf.append(DELIM_REGULAR).append(eventId);
              }
              prevId = eventId;
          }
          return buf.toString();
      }
docs: Combine multiple EventStore event IDs into a single Databus event key.  To get the most compact encoded string,
  sort the event ID list before encoding it.