由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Java版 - answer Re: how HashMap/Hashtable compare key?
相关主题
Java的工作面试主要考什么?主要是算法吗?Object比较
问个hashtable实现问题问个set和literal String的问题
问个Object.hashCode()的问题Leetcode ==> Max Points on a Line, 我的程序到底哪出问题了
treemap和hashma p的问题问个Hashtable的问题
[转载] How do I sort a map in Java?Java 面试常见问题!
请教一段代码,关于hashCode()HashMap cache
也问个 HashMap问题Java Map 存 1 million 记录
请问这个面试题,关于synchronize hashmapoverride/overload/overwrite in Java
相关话题的讨论汇总
话题: hashmap话题: hashtable话题: hashcode话题: override话题: key
进入Java版参与讨论
1 (共1页)
r*******w
发帖数: 121
1
1. rule of thumb: if you override equals, you have to override
hashCode...(though if you don't put your class as key used in
collection/map/set etc, i don't see any point of override hashCode ;-)...well,
if your class is distinct for every instance of it...no need to do this too...
2. (true or not? don't know...though make sense) HashMap/Hashtable will first
check if any two objects hash to the same bucket...by comparing the result
from hashCode...if the two objects map to the same bucket, they
1 (共1页)
进入Java版参与讨论
相关主题
override/overload/overwrite in Java[转载] How do I sort a map in Java?
Re: 谁有Java或Oracle的毒招 ?请教一段代码,关于hashCode()
大家写java class的时候是完全封装的么?也问个 HashMap问题
Do I need to implement equals and hashCode in domain object请问这个面试题,关于synchronize hashmap
Java的工作面试主要考什么?主要是算法吗?Object比较
问个hashtable实现问题问个set和literal String的问题
问个Object.hashCode()的问题Leetcode ==> Max Points on a Line, 我的程序到底哪出问题了
treemap和hashma p的问题问个Hashtable的问题
相关话题的讨论汇总
话题: hashmap话题: hashtable话题: hashcode话题: override话题: key