On 07/04/2020 13:43, Alex Herbert wrote:

Fraction

I also did a big arrangement of Fraction and BigFraction.

I noticed that hashCode is using some variant of the format used in Arrays.hashCode(...)

I wondered if we should standardise on returning a value as if computed using e.g. Arrays.hashCode(new int[]{numerator, denominator}) as was done for Complex with its two parts.

This would change in Fraction:

public int hashCode() {
    return 37 * (37 * 17 + numerator) + denominator;
}

to

public int hashCode() {
    return 31 * (31 + numerator) + denominator;
}

Alex



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org

Reply via email to