dcsimg
hashmap having keys of different datatypes
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anil_Reddy
Posted On:   Monday, February 23, 2004 03:21 AM

how do i get the values of a perticular key for hashmap having keys of different datatypes.what data type should i use to make it dynamic.

Re: hashmap having keys of different datatypes

Posted By:   Marco_Marquez  
Posted On:   Monday, February 23, 2004 01:51 PM

You can create a subclass of a HashMap and overwrite the containsKey() and get() methods calling toString() method in order to compare Strings instead of data types.



Another option is to use a TreeMap and set a Comparator. This comparator will help you to order and convert keys into a same data type.
About | Sitemap | Contact