sort hash map key sets before output