Hi Miga: Very good. This will not be a real TreeMap because the HashMap will still be backing. Isn't this like clonig?
Respects, JKid314159 http://existentialists.blogspot.com/ P Please don't print this e-mail unless you really need to. --- On Tue, 8/11/09, miga <[email protected]> wrote: From: miga <[email protected]> Subject: [java programming] Re: Lab1016.3.1 To: "Free Java Programming Online Training Course By Sang Shin" <[email protected]> Date: Tuesday, August 11, 2009, 5:25 PM 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 -~----------~----~----~----~------~----~------~--~---
