What is the main advantage of using Hashtable comparing with HashMap. Because, Hashtable main advantage is synchronization.
Now map can also synchronized using synchronizedMap().
Map m = Collections.synchronizedMap(hashMap);
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Hashtableexisted before the collections framework, so it is retained mainly for backward compatibility. UseConcurrentHashMapinstead.Note that there is a slight semantic difference –
Hashtabledoes not allow nulls, whileHashMapallows null values and a null key.