Kevin.Zhong

彪悍的人生不需要解释,彪悍的代码不需要测试。

  BlogJava :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理 ::
  17 随笔 :: 12 文章 :: 14 评论 :: 0 Trackbacks
ArrayList 默认的大小为 10

ArrayList源代码:

/**
* Constructs an empty list with an initial capacity of ten.
*/

public ArrayList() {

this(10);

}
HashSet默认大小与HashMap一样 为 16 (因为HashSet就是使用HashMap的key来保存对象)

HashMap源代码:

static final int DEFAULT_INITIAL_CAPACITY = 16;

/**
* Constructs an empty <tt>HashMap</tt> with the default initial capacity
* (16) and the default load factor (0.75).
*/

public HashMap() {

this.loadFactor = DEFAULT_LOAD_FACTOR;

threshold 
= (int)(DEFAULT_INITIAL_CAPACITY * DEFAULT_LOAD_FACTOR);

table 
= new Entry[DEFAULT_INITIAL_CAPACITY];

init();

}

posted on 2008-10-10 11:15 Kevin.Zhong 阅读(995) 评论(0)  编辑  收藏 所属分类: Java基础

只有注册用户登录后才能发表评论。


网站导航: