标签:
测试代码:
int initialCapacity = 16;
float loadFactor = 0.75f;
HashMap<String,String> hashMap = new HashMap<>(initialCapacity,loadFactor);
System.out.println(hashMap.put("1","v1"));
System.out.println(hashMap.put("1","v2"));
Iterator<String> it = hashMap.keySet().iterator();
while (it.hasNext()){
System.out.println(hashMap.get(it.next()));
}
HashMap构造方法中两个参数initialCapacity(初始化容器大小),loadFactor(负载因子)
标签:
原文地址:http://www.cnblogs.com/cedontiancaia/p/5098194.html