@Override public boolean equals(Object obj) { if(obj == null) { return false; } if(obj == this) { return true; } if(this.getClass().equals(obj.getClass())) { return true; } return super.equals(obj); }
@Override public boolean equals(Object obj) { if(this == obj) { return true; } if(obj == null) { return false; } if(!(obj instanceof WeightedLPNormDistanceFunction)) { if(obj instanceof LPNormDistanceFunction && super.equals(obj)) { for(double d : weights) { if(d != 1.) { return false; } } return true; } return false; } WeightedLPNormDistanceFunction other = (WeightedLPNormDistanceFunction) obj; return Arrays.equals(this.weights, other.weights); }