besides using Collections to get a synchronized version of a
`TreeMap`, another approach to get a output according to sorted key is to do the reverse using a helper class.
for example, using ObjectMapper
//set the ordering
mapper.configure(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS, true);
then to get the output or transform to another object, using the `mapper`
//output
mapper.writeValueAsString(pairs)
//transform
mapper.convertValue(pairs, Map.class)