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

后端 未结 30 2428
青春惊慌失措
青春惊慌失措 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 14:00

    Based on the info here, I'd recommend going with HashMap. I think the biggest advantage is that Java will prevent you from modifying it while you are iterating over it, unless you do it through the iterator.

提交回复
热议问题