docs: private int merge(String[] dst, String[] srcA, int lengthA, Tag[] srcB, int lengthB) {
      int i = 0;
      int ai = 0;
      int bi = 0;
  
      while (ai < lengthA && bi < lengthB) {
        final String ak = srcA[ai];
        final String av = srcA[ai + 1];
        Tag b = srcB[bi];
        int cmp = ak.compareTo(b.key());
        if (cmp < 0) {
          dst[i++] = ak;
          dst[i++] = av;
          ai += 2;
        } else if (cmp > 0) {
          dst[i++] = b.key();
          dst[i++] = b.value();
          ++bi;
        } else {
          // Newer tags should override, use source B if there are duplicate keys.
          // If source B has duplicates, then use the last value for the given key.
          int j = bi + 1;
          for (; j < lengthB && ak.equals(srcB[j].key()); ++j) {
            b = srcB[j];
          }
          dst[i++] = b.key();
          dst[i++] = b.value();
          bi = j;
          ai += 2; // Ignore
        }
      }
  
      if (ai < lengthA) {
        System.arraycopy(srcA, ai, dst, i, lengthA - ai);
        i += lengthA - ai;
      } else if (bi < lengthB) {
        i = dedup(srcB, bi, dst, i, lengthB - bi);
      }
  
      return i;
    }