hashMap是根据key的hashCode来寻找存放位置的,那当key为null时, 怎么存储呢?
答案:
当key为null时,value存在了HashMap底层table数组的table[0]位置,之后具体的存储方式和其他索引位置一致
HashMap中key为null时,value存到哪里去了?
阅读 49
2022-07-29
hashMap是根据key的hashCode来寻找存放位置的,那当key为null时, 怎么存储呢?
答案:
当key为null时,value存在了HashMap底层table数组的table[0]位置,之后具体的存储方式和其他索引位置一致
相关推荐
精彩评论(0)