On Aug 11, 9:39 pm, JKid314159 <[email protected]> wrote:
> Lab 1016 Exercise 3.1.4
>
> Hi:
>
> I created a HashMap with the keys and values as requested. I am unsure how
> to sort this. The keys are strings of the following: 1st, 2nd, 3rd, 4th, 5th?
Transform the HashMap into a TreeMap to display the keys sorted,
something like this:
// Display it sorted
Map<String, Object> myTreeMap = new TreeMap<String, Object>();
myTreeMap.putAll(myHashMap);
System.out.println("My hash map in sorted order" + myTreeMap);
Another API to read: TreeMap ;-)
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/javaprogrammingwithpassion?hl=en
-~----------~----~----~----~------~----~------~--~---