由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Java版 - Re: weird problem with hashtable--CONCLUSION
相关主题
Java的工作面试主要考什么?主要是算法吗?问个Hashtable的问题
问个hashtable实现问题SortedSet的问题
Object比较Java大侠们:Hashtable help please!
Re: hashtableJava 面试常见问题!
answer Re: how HashMap/Hashtable compare key?Help
[转载] Pair in java???reverse the bit order of a byte
a simple java programming questionjava的源程序值得看看
ObjectOutputStream.writeObject(Hashtable) ?HashMap cache
相关话题的讨论汇总
话题: hashtable话题: conclusion话题: problem话题: weird
进入Java版参与讨论
1 (共1页)
n*****a
发帖数: 4
1
All right we are all wrong here, it's ACTUALLY a BUG in
jdk1.1.x,
try using jdk1.2.2 and the problem is gone. equals() will be
called and containsKey() will return true.
m**r
发帖数: 13
2
I think things should be like this:
When containsKey(o) is called, it calculate the o.hashCode()
and use this integer to look into the correspond position in hashtable,
get the value v and then use v.equals(o) to determine if o is in
the table.
Note: the equals method is called only ONCE.
So I think that's the answer.
Maybe actually, the key in hashtable is o.hashCode() rather than the
object o.

【在 n*****a 的大作中提到】
: All right we are all wrong here, it's ACTUALLY a BUG in
: jdk1.1.x,
: try using jdk1.2.2 and the problem is gone. equals() will be
: called and containsKey() will return true.

1 (共1页)
进入Java版参与讨论
相关主题
HashMap cacheanswer Re: how HashMap/Hashtable compare key?
An interview question[转载] Pair in java???
java里面使用icon的问题a simple java programming question
如何遍历hashtable里边的每一项? ObjectOutputStream.writeObject(Hashtable) ?
Java的工作面试主要考什么?主要是算法吗?问个Hashtable的问题
问个hashtable实现问题SortedSet的问题
Object比较Java大侠们:Hashtable help please!
Re: hashtableJava 面试常见问题!
相关话题的讨论汇总
话题: hashtable话题: conclusion话题: problem话题: weird