hashmap的get
时间: 2023-10-19 18:30:02 浏览: 139
HashMap的get方法是用于获取指定键对应的值的方法。在HashMap中,键值对是通过哈希函数计算得到的散列码来确定存储位置的。get方法首先会通过hash(key)方法计算出key的哈希值,并根据哈希值找到对应的存储位置。接着,通过比较键值对中的键与给定的key来找到匹配的键值对,并返回其对应的值。如果没有找到匹配的键值对,则返回null。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [hashMap1.8源码](https://download.csdn.net/download/qq_38384460/14819831)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *2* [HashMap之get方法详解](https://blog.csdn.net/weixin_39667787/article/details/86687414)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *3* [HashMap中get方法详解](https://blog.csdn.net/lubiaojava/article/details/119779611)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"]
[ .reference_list ]
阅读全文