Map myMap = Collections.synchronizedMap (myMap);
synchronizes the operations on myMap collection class my question is if i have synchronize any way then why i should not be using Hashtable ? is Collections.synchronizedMap provide some extra functionality
i have also been told that Hashtable and Vector make your Operation slow and but would not Collections.synchronizedMap be making your operations on map slow? my question is more towards what is the advantages developers see in using Collections.synchronizedMap than to use Hashtable.
Vector & Hashtable are both leftovers (legacy) from 1.0 API and still available only due to the compatibility reasons ...
cherry ch wrote:
I have also been told that Hashtable and Vector make your Operation slow and but would not Collections.synchronizedMap be making your operations on map slow?
In general the above statement is true (twice), however you're missing the point.
The idea is, that we have the control whether we want too synchronize our collection or not.
Beside this, a Map has various specialized implementations designed for different cases and/or usages (in regards the performance): access, removal, inserting, "ordering", etc..