0

I am building a trie, each node has a hashmap with sons' value stored, and keys are their name.

I'm using hashmap because, mainly, I need performances instead of sorting, instead I would have used treemap, of course.

Now, I need, just in a function, to sort hash map values by key values (that are strings). Now I'm using iterator to iterate values.

Any suggest?

Thank you

litiales
  • 171
  • 4
  • 12
  • You should also take a look at this: http://stackoverflow.com/questions/245878/how-do-i-choose-between-a-hash-table-and-a-trie-prefix-tree – srikanta May 04 '13 at 10:14

1 Answers1

4

You should put the map.keySet in a list sort it and iterate on this list of sorted keys.

Sebastien
  • 5,506
  • 4
  • 27
  • 37