HashTable:在并发的环境下,使用synchronized将整张表锁住;

HashTable构造函数有:

  1. public Hashtable(int initialCapacity, float loadFactor)
  2. public Hashtable(int initialCapacity)
  3. public Hashtable()
  4. public Hashtable(Map<? extends K, ? extends V> t)
/**
* Constructs a new, empty hashtable with the specified initial
* capacity and the specified load factor.
*
* @param initialCapacity the initial capacity of the hashtable.
* @param loadFactor the load factor of the hashtable.
* @exception IllegalArgumentException if the initial capacity is less
* than zero, or if the load factor is nonpositive.
*/
public Hashtable(int initialCapacity, float loadFactor) {
if (initialCapacity < 0)
throw new IllegalArgumentException("Illegal Capacity: "+
initialCapacity);
if (loadFactor <= 0 || Float.isNaN(loadFactor))
throw new IllegalArgumentException("Illegal Load: "+loadFactor); if (initialCapacity==0)
initialCapacity = 1;
this.loadFactor = loadFactor;
table = new Entry<?,?>[initialCapacity];
threshold = (int)Math.min(initialCapacity * loadFactor, MAX_ARRAY_SIZE + 1);
} /**
* Constructs a new, empty hashtable with the specified initial capacity
* and default load factor (0.75).
*
* @param initialCapacity the initial capacity of the hashtable.
* @exception IllegalArgumentException if the initial capacity is less
* than zero.
*/
public Hashtable(int initialCapacity) {
this(initialCapacity, 0.75f);
} /**
* Constructs a new, empty hashtable with a default initial capacity (11)
* and load factor (0.75).
*/
public Hashtable() {
this(11, 0.75f);
} /**
* Constructs a new hashtable with the same mappings as the given
* Map. The hashtable is created with an initial capacity sufficient to
* hold the mappings in the given Map and a default load factor (0.75).
*
* @param t the map whose mappings are to be placed in this map.
* @throws NullPointerException if the specified map is null.
* @since 1.2
*/
public Hashtable(Map<? extends K, ? extends V> t) {
this(Math.max(2*t.size(), 11), 0.75f);
putAll(t);
}

最新文章

  1. openssl和Java的keytool证书相关的命令总结
  2. VS2013使用EF6与mysql数据库
  3. python 学习笔记12(序列常用方法总结)
  4. Linux下修改计算机名
  5. Android 使用Fragment,ViewPagerIndicator 制作csdn app主要框架
  6. 开发设计模式(七)工厂模式(Factory Method Pattern)
  7. 1089-Duplicate Removal
  8. hdoj 2187 悼念512汶川大地震遇难同胞——老人是真饿了【贪心部分背包】
  9. 解决Linux下Oracle中文乱码的一些心得体会 ,转自
  10. C++程序面试笔迹六
  11. python非转基因HTTP请求库--Requests: 让 HTTP 服务人类
  12. Spring_Spring与IoC_Bean的装配
  13. Python_tkinter(2)_常用控件
  14. Hadoop 进程配置总结
  15. P4177 [CEOI2008]order(网络流)最大权闭合子图
  16. java对之前的复习
  17. git命令详解( 二 )
  18. 20145215《网络对抗》Exp7 网络欺诈技术防范
  19. Bootstrap and Angular
  20. linux下部署redis

热门文章

  1. 总结SQL Server窗口函数的简单使用
  2. Android学习总结(六)———— 发送自定义广播
  3. 网络大牛如何回答Chrome的15个刁钻面试题?
  4. (转)SpringMVC学习(一)——SpringMVC介绍与入门
  5. Asp.Net Core 入门(五)—— 布局视图_Layout.cshtml
  6. 线程锁(互斥锁Mutex)
  7. 8 Java 归并排序(MergerSort)
  8. oracle row_number的使用
  9. Spring框架针对dao层的jdbcTemplate操作crud之query查询数据操作 —— 查询表,返回结果为对象的list集合
  10. 使用Fiddler抓取IOS_APP的请求