У меня есть простой класс Point с двумя полями типа double
.Я попросил Eclipse 3.6 сгенерировать equals()
и hashCode()
для него.Метод equals()
выглядит следующим образом:
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Point other = (Point) obj;
if (!getOuterType().equals(other.getOuterType()))
return false;
if (Double.doubleToLongBits(x) != Double.doubleToLongBits(other.x))
return false;
if (Double.doubleToLongBits(y) != Double.doubleToLongBits(other.y))
return false;
return true;
}
А getOuterType
выглядит следующим образом:
private Point getOuterType() {
return Point.this;
}
Итак, вопрос в том: какова цель строки getOuterType().equals(other.getOuterType())
?