null values and the null key. (The HashMap class is roughly equivalent to Hashtable, except that it is unsynchronized and permits nulls.) This class makes no guarantees as to the order of the map; in particular, it does not guarantee that the order will remain constant over time.
哈希表是通过实现 Map 接口实现的,因为 Map 接口提供了所有的映射操作,并且允许空值和空键(HashMap这个类可以简单的看作是 HashTable 类,与之不同是,HashMap 是非同步且允许存储空数据的) 。HashMap 这个类不保证映射的顺序,特别是不保证这个顺序会随着时间的改变而保持不变 。
This implementation provides constant-time performance for the basic operations (当哈希函数恰当地将元素映射到哈希桶(the buckets)中,那么就具有常量时间里的基本操作(get 和 put)性能 。遍历 HashMap 这个集合的时候,遍历的时间与 HashMap 实例的容量(哈希桶的数量)加上它的大小(Key和Value的映射数量,即键值对的数量)成正比,因此,不要设置初始的容量太高,或者负载因子太低,这是非常重要的 。getandput), assuming the hash function disperses the elements properly among the buckets. Iteration over collection views requires time proportional to the "capacity" of theHashMapinstance (the number of buckets) plus its size (the number of key-value mappings). Thus, it's very important not to set the initial capacity too high (or the load factor too low) if iteration performance is important.
An instance ofHashMaphas two parameters that affect its performance:经验总结扩展阅读
- 四十 Salesforce LWC学习 dynamic interaction 浅入浅出
- 1.76尸王殿怎么走(尸王殿走法图解)
- 热血传奇1.76未知暗殿怎么走(热血传奇未知暗殿的凭证哪里出)
- VS Code For Web 深入浅出 -- 进程间通信篇
- 1.7级地震严重吗
- VS Code For Web 深入浅出 -- 导读篇
- 祖玛教主怎么走(传奇1.76祖玛教主在哪)
- vue2.x核心源码深入浅出,我还是去看源码了
- 创造与魔法11.7礼包兑换码是多少
- 空调1.75匹是什么意思

 
   
   
   
   
   
   
   
   
   
   
   
  