code: public void merge(Metadata other, Set<Key<?>> keys) {
      Preconditions.checkNotNull(other, "other");
      // Use ByteBuffer for equals and hashCode.
      Map<ByteBuffer, Key<?>> asciiKeys = new HashMap<>(keys.size());
      for (Key<?> key : keys) {
        asciiKeys.put(ByteBuffer.wrap(key.asciiName()), key);
      }
      for (int i = 0; i < other.size; i++) {
        ByteBuffer wrappedNamed = ByteBuffer.wrap(other.name(i));
        if (asciiKeys.containsKey(wrappedNamed)) {
          maybeExpand();
          name(size, other.name(i));
          value(size, other.value(i));
          size++;
        }
      }
    }
docs: Merge values from the given set of keys into this set of metadata. If a key is present in keys,
  then all of the associated values will be copied over.
  
  @param other The source of the new key values.
  @param keys The subset of matching key we want to copy, if they exist in the source.