dcsimg
HashMap where keys can't be changed but values can be
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   a_b
Posted On:   Tuesday, October 10, 2006 10:18 AM

Is it possible to create a HashMap where the keys are fixed i.e. keys can't be modified by another class, but that class can change the values for those keys in the hashmap?



Thanks

Re: HashMap where keys can't be changed but values can be

Posted By:   Robert_Lybarger  
Posted On:   Tuesday, October 10, 2006 01:43 PM

You could probably subclass the standard HashMap class to add some enforcement rules to the put(Object,Object) method (etc). As far as getting values in it initially, possibly use a copy constructor to take values from a [temporary] standard HashMap instance? Just a wild (and not thought out) idea.
About | Sitemap | Contact