| Forums.Sureshkumar.net : A Perfect Place to Share Knowledge Blogs Games Magazines |
|
|
#1 (permalink) |
|
Senior Member
Join Date: Aug 2006
Age: 28
Posts: 275
Thanks: 0 Thanked 5 Times in 5 Posts Thanks: 0
Thanked 5 Times in 5 Posts
Rep Power: 5
|
Methods in TREEMAP?
Q.) How to ascend or descend the elements in Tree Map?
Q.) What is the advantage of TreeMap Over Hash Map? |
|
|
|
|
|
#2 (permalink) |
|
Member
Join Date: Jan 2007
Posts: 32
Thanks: 3 Thanked 3 Times in 3 Posts Thanks: 3
Thanked 3 Times in 3 Posts
Rep Power: 2
|
Re: Methods in TREEMAP?
Q.) What is the advantage of TreeMap Over Hash Map?
TreeMap is used when the keys should preserve some order. And the Hash Map is used when there is no need of preserving the order. similarities Hash Map and Tree Map both are not synchronized. Both implements Abstract Map Q.) How to ascend or descend the elements in Tree Map? A) two ways of this 1.Firt one is implement the our own comparitor so that it will put the keys in the order which we want 2. Get the key set and use the external sorting of the keys by sorting the key set it self and retrive the values.
__________________
Cheers, Laxmi |
|
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| J2EE - What is the class containing all the methods as static? | preethisingh | Java Interview / Technical Questions | 3 | 03-10-07 06:48 PM |
| J2EE - Why are the methods of the Math class static? | preethisingh | Java Interview / Technical Questions | 0 | 23-01-07 07:00 PM |
| J2EE - Isn't it redundant to have to mark the methods final if the class is final? | preethisingh | Java Interview / Technical Questions | 0 | 23-01-07 03:05 PM |
| J2EE - What are native methods? How do you use them? | preethisingh | Java Interview / Technical Questions | 0 | 23-01-07 03:02 PM |
| java JSP | naga | JAVA Technologies | 4 | 21-08-06 05:03 PM |