I need a replacement for HashTable in my design. Restriction: > can use only vector, properties,hashtable
> I have a util class where we are using hashtable h1 as parameter in method1. > this util class will be used by a number of users. > the users will set the values in h1 and will call method1 (h1 as param). > The keys for h1 has been defined in util class and I am expecting the users to use the same key > But in real use case the users can define their own key and in that case in util class we will get null value which will disrupt the processing of method 1
Please think of it and give suggestions. I will update your queries
So, you want to replace HashTable with either a Vector or Properties? Well, neither of these two classes are good replacements for HashTable -- as Vector doesn't have keys, and you don't need the file support of the Properties class.
> But in real use case the users can define their own key and in that case in util class we will get null value which will disrupt the processing of method 1
Well, you could put more validity checks in method1() to make sure that the parameters (key-values) are valid. Generally, public methods should do this anyway.