docs: void writeChildren(TreeMap<Character, Long> counts) {
      int firstIndex = trie.nodes.length();
      counts.forEach((k, v) -> {
        if (v > 0) trie.nodes.add(new NodeData(k, (short) -1, -1, v, -1));
      });
      short length = (short) (trie.nodes.length() - firstIndex);
      trie.ensureParentIndexCapacity(firstIndex, length, index);
      update(n -> n.setFirstChildIndex(firstIndex).setNumberOfChildren(length));
      data = null;
    }