public LinkedHashMap(int initialCapacity,
float loadFactor,
boolean accessOrder)Constructs an empty LinkedHashMap instance with the specified initial capacity, load factor and ordering mode.
Parameters:
initialCapacity - the initial capacity
loadFactor - the load factor
accessOrder - the ordering mode - true for access-order, false for insertion-order
Throws:
IllegalArgumentException - if the initial capacity is negative or the load factor is nonpositive
这是API上的信息,看了之后,感觉还不是很懂,大侠们能帮忙讲解下三个参数的作用么?尤其是最后两个。谢谢
float loadFactor,
boolean accessOrder)Constructs an empty LinkedHashMap instance with the specified initial capacity, load factor and ordering mode.
Parameters:
initialCapacity - the initial capacity
loadFactor - the load factor
accessOrder - the ordering mode - true for access-order, false for insertion-order
Throws:
IllegalArgumentException - if the initial capacity is negative or the load factor is nonpositive
这是API上的信息,看了之后,感觉还不是很懂,大侠们能帮忙讲解下三个参数的作用么?尤其是最后两个。谢谢
解决方案 »
- JAVA正则表达式
- String s = "sdfasdf"; s[3]这样的访问方式有问题吗?
- 简单的菜鸟级
- java我用double型定2.33,3.22这样几个数但运行2.33,3.22这样的数与int的数字相乘后,会变结果6.20000000000001
- 不知道哪里的毛病,关于WOW密保卡读取密保卡卡码的小程序~~~
- 哪位仁兄有有关检索方面的资料?
- swing 如何实现表格树,有现成的代码码?swing包中并没有TableTreeView东东
- 各位朋友,帮帮忙!
- 关于单元测试的问题,请大家帮帮忙
- 急急急急急急急??????
- 求助:请问有没有什么java开源组件能将网页转成图片?
- 窗口背景图片覆盖按钮怎么办啊啊啊啊啊啊?
loadFactor: 当已经被使用的Hash桶数目达到总数*loadFactor,需要进行扩容,容量变成之前的2倍
accessOrder:LRU在这里体现,当这个值为true的时候,使用的就是LRU算法,也就是最近访问的放在最前面,最近少访问的放在后面。具体实现办法是,当使用get()方法获取一个值后,会把这个值所在的hash桶放在所有桶的最前面,这样下次访问可以最快取得。说点题外话,其实,除非做那种对效率要求非常高的应用,不然真的不用关心这些数据结构的底层细节。