public CharSequence join(String field, Collection<String> values, Charset charset) {
    StringBuilder builder = new StringBuilder();
    int valueCount = 0;
    for (String value : values) {
      if (separator == null) {
        // exploded
        builder.append(valueCount++ == 0 ? "" : "&");
        builder.append(UriUtils.encode(field, charset));
        if (value != null) {
          builder.append('=');
          builder.append(value);
        }
      } else {
        // delimited with a separator character
        if (builder.length() == 0) {
          builder.append(UriUtils.encode(field, charset));
        }
        if (value == null) {
          continue;
        }
        builder.append(valueCount++ == 0 ? "=" : UriUtils.encode(separator, charset));
        builder.append(value);
      }
    }
    return builder;
  }
Joins the field and possibly multiple values with the given separator.

<p>Calling EXPLODED.join("foo", ["bar"]) will return "foo=bar".

<p>Calling CSV.join("foo", ["bar", "baz"]) will return "foo=bar,baz".

<p>Null values are treated somewhat specially. With EXPLODED, the field is repeated without any
"=" for backwards compatibility. With all other formats, null values are not included in the
joined value list.

@param field The field name corresponding to these values.
@param values A collection of value strings for the given field.
@param charset to encode the sequence
@return The formatted char sequence of the field and joined values. If the value collection is
    empty, an empty char sequence will be returned.
core/src/main/java/feign/CollectionFormat.java