@Override public boolean equals(Object obj){
  if (!(obj instanceof Position)) {
    return false;
  }
  if (obj == this) {
    return true;
  }
  Position position=(Position)obj;
  if (position.getLatitude() != latitude) {
    return false;
  }
 else   if (position.getLongitude() != longitude) {
    return false;
  }
 else   if (Double.isNaN(position.getAltitude()) != Double.isNaN(altitude)) {
    return false;
  }
 else   if (!Double.isNaN(altitude) && position.getAltitude() != altitude) {
    return false;
  }
  return true;
}

@ Override public boolean equals ( Object obj ) { if ( ! ( obj instanceof Position ) ) { return false ; } if ( obj == this ) { return true ; } Position position = ( Position ) obj ; if ( position . getLatitude ( ) != latitude ) { return false ; } else if ( position . getLongitude ( ) != longitude ) { return false ; } else if ( Double . isNaN ( position . getAltitude ( ) ) != Double . isNaN ( altitude ) ) { return false ; } else if ( ! Double . isNaN ( altitude ) && position . getAltitude ( ) != altitude ) { return false ; } return true ; }
indicates whether some other object is " equal to " this one .
