我有这个简单的类POD的Java hashCode?
public class Position{
int x;
int y;
Position(int x,int y){...}
public int hashCode(){
Integer ix = this.x;
Integer iy = this.y;
return 13*iy.hashCode() + 43*ix.hashCode();
}
}
在hashMap
林存储实例,但随后倾斜检索。我担心它的实现。当x和y不是对象时,有什么办法可以实现它吗?
在此先感谢
什么是哈希表? – 2010-08-23 03:40:25
那它是什么?缺少等于? – Thilo 2010-08-23 04:13:24
涉及蹩脚平等的糟糕决定的组合。 – Tom 2010-08-23 04:31:53