What are the differences between a HashMap and a Hashtable in Java?

后端 未结 30 3107
青春惊慌失措
青春惊慌失措 2020-11-21 13:30

What are the differences between a HashMap and a Hashtable in Java?

Which is more efficient for non-threaded applications?

30条回答
  •  别那么骄傲
    2020-11-21 13:49

    Hashtable is considered legacy code. There's nothing about Hashtable that can't be done using HashMap or derivations of HashMap, so for new code, I don't see any justification for going back to Hashtable.

提交回复
热议问题