static <T> @NotNull Collector<T, ?, CompoundBinaryTag> toCompoundTag(final @NotNull CompoundBinaryTag initial, final @NotNull Function<T, String> keyLens, final @NotNull Function<T, ? extends BinaryTag> valueLens) {
    requireNonNull(initial, "initial");
    requireNonNull(keyLens, "keyLens");
    requireNonNull(valueLens, "valueLens");

    return Collector.of(
      () -> CompoundBinaryTag.builder().put(initial),
      (b, ent) -> b.put(keyLens.apply(ent), valueLens.apply(ent)),
      (l, r) -> l.put(r.build()),
      CompoundBinaryTag.Builder::build,
      Collector.Characteristics.UNORDERED
    );
  }
Create a {@link Collector} to consume streams of a user-chosen type, with initial contents.

<p>In the event of duplicate keys, the last seen entry will be preserved.</p>

@param <T> the stream value type
@param initial an existing tag that will initialize the builder
@param keyLens a function to extract a key from the target object
@param valueLens a function to extract a tag value from the target object
@return a collector creating compound tags
@since 4.21.0
nbt/src/main/java/net/kyori/adventure/nbt/CompoundBinaryTag.java