This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
by default hashtable gives synchronization; why they have written Collections.synchronizedMap(new HashMap());
whta benefits will it give?
It has to do with history... The hashtable map was available right from the beginning -- and it was thread safe. With java 1.2, they added a huge set of collections, and decided to let the developer decide whether it should be synchronized -- hence, the collections class. They can't change the fuctionality of hashtable, or older programs will break.
Besides, there are different types of hashmap classes, tree, sorted, etc., that can be synchronized by the collections class.