It seems that this got reverted at some point: http://code.google.com/p/google-web-toolkit/source/diff?spec=svn2434&r=2434&format=side&path=/trunk/user/super/com/google/gwt/emul/java/lang/Double.java
does anyone know why? On Mar 31, 2:35 pm, googelybear <googelyb...@gmail.com> wrote: > I just found a post in the gwt contributors group but I cannot find it > anywhere in gwt, any > ideas?http://groups.google.com/group/google-web-toolkit-contributors/browse... > > On Mar 31, 2:20 pm, googelybear <googelyb...@gmail.com> wrote: > > > > > Hi, > > > this question might seem stupid but how can one implement hashCode() > > and equals() for a simple 2d point class as follows: > > > public class Point { > > > private double fX; > > > private double fY; > > > public double getX() { > > return fX; > > } > > > public void setX(double x) { > > this.fX= x; > > } > > > public double getY() { > > return fY; > > } > > > public void setY(double y) { > > this.fY= y; > > } > > > } > > > The generated equals() and hashCode() methods from Eclipse do NOT work > > with GWT as method Double.doubleToLongBits() is missing: > > > @Override > > public int hashCode() { > > final int prime= 31; > > int result= 1; > > long temp; > > temp= Double.doubleToLongBits(fX); > > result= prime * result + (int) (temp ^ (temp >>> 32)); > > temp= Double.doubleToLongBits(fY); > > result= prime * result + (int) (temp ^ (temp >>> 32)); > > return result; > > } > > > @Override > > public boolean equals(Object obj) { > > if (this == obj) > > return true; > > if (obj == null) > > return false; > > if (!(obj instanceof Point)) > > return false; > > Point other= (Point) obj; > > if (Double.doubleToLongBits(fX) != > > Double.doubleToLongBits(other.fX)) > > return false; > > if (Double.doubleToLongBits(fY) != > > Double.doubleToLongBits(other.fY)) > > return false; > > return true; > > } > > > Does anyone have an idea how to implement this? > > > thanks a bunch, > > > Dennis -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.