A
Ahmed Moustafa
What are the differences between HashMap and TreeMap? What is the
application of each implementation?
Thanks in advance!
application of each implementation?
Thanks in advance!
Christophe Vanfleteren said:A TreeMap implements SortedMap, so when you iterate over the contents,
you'll get the content sorted by either their natural order, or by a
Comparator you definied when creating the TreeMap.
With the regular HashMap, iterating over the content can result in any order
(you won't get them in eg. the order you inserted them into the Map).
What are the differences between HashMap and TreeMap? What is the
application of each implementation?
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.