小白一个求问,HashMap和HashedMap有什么区别

笨笨哒 发布于 2017/03/21 10:07
阅读 5K+
收藏 0

如题

加载中
1
人生设计师
人生设计师

HashMap是JDK内置的集合类,而HashedMap是apache的commons项目出的工具类,可以用于替代HashMap,增加了一些新的功能。

0
caiw
caiw

HashedMap 是什么鬼

0
JianF
JianF

https://commons.apache.org/proper/commons-collections/jacoco/org.apache.commons.collections4.map/HashedMap.java.html

  1. /**
  2.  * A <code>Map</code> implementation that is a general purpose alternative
  3.  * to <code>HashMap</code>.
  4.  * <p>
  5.  * This implementation improves on the JDK1.4 HashMap by adding the
  6.  * {@link org.apache.commons.collections4.MapIterator MapIterator}
  7.  * functionality and many methods for subclassing.
  8.  * <p>
  9.  * <strong>Note that HashedMap is not synchronized and is not thread-safe.</strong>
  10.  * If you wish to use this map from multiple threads concurrently, you must use
  11.  * appropriate synchronization. The simplest approach is to wrap this map
  12.  * using {@link java.util.Collections#synchronizedMap(Map)}. This class may throw
  13.  * exceptions when accessed by concurrent threads without synchronization.
  14.  *
  15.  * @since 3.0
  16.  * @version $Id: HashedMap.java.html 972397 2015-11-14 15:01:49Z tn $
  17.  */
0
蓝风970655147
蓝风970655147

hash的计算方式不一样, HashedMap似乎 有一个mapIterator接口

返回顶部
顶部