public static int writeIntMapLists(Map<Integer, List<Integer>> map, ByteBuffer buffer) {
    if (map == null) {
      return write(-1, buffer);
    }

    int length = 0;
    buffer.putInt(map.size());
    for (Map.Entry<Integer, List<Integer>> entry : map.entrySet()) {
      buffer.putInt(entry.getKey());
      buffer.putInt(entry.getValue().size());
      entry.getValue().forEach(buffer::putInt);
    }
    return length;
  }
write a string map to buffer

@return length
iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/utils/BasicStructureSerDeUtil.java