BigComplex { @Override public int hashCode() { return Objects.hash(re, im); } private  BigComplex(BigDecimal re, BigDecimal im); BigComplex add(BigComplex value); BigComplex add(BigComplex value, MathContext mathContext); BigComplex add(BigDecimal value, MathContext mathContext); BigComplex add(BigDecimal value); BigComplex add(double value); BigComplex subtract(BigComplex value); BigComplex subtract(BigComplex value, MathContext mathContext); BigComplex subtract(BigDecimal value, MathContext mathContext); BigComplex subtract(BigDecimal value); BigComplex subtract(double value); BigComplex multiply(BigComplex value); BigComplex multiply(BigComplex value, MathContext mathContext); BigComplex multiply(BigDecimal value, MathContext mathContext); BigComplex multiply(BigDecimal value); BigComplex multiply(double value); BigComplex divide(BigComplex value, MathContext mathContext); BigComplex divide(BigDecimal value, MathContext mathContext); BigComplex divide(double value, MathContext mathContext); BigComplex reciprocal(MathContext mathContext); BigComplex conjugate(); BigComplex negate(); BigDecimal abs(MathContext mathContext); BigDecimal angle(MathContext mathContext); BigDecimal absSquare(MathContext mathContext); boolean isReal(); BigComplex re(); BigComplex im(); BigComplex round(MathContext mathContext); @Override int hashCode(); @Override boolean equals(Object obj); boolean strictEquals(Object obj); @Override String toString(); static BigComplex valueOf(BigDecimal real); static BigComplex valueOf(double real); static BigComplex valueOf(double real, double imaginary); static BigComplex valueOf(BigDecimal real, BigDecimal imaginary); static BigComplex valueOfPolar(BigDecimal radius, BigDecimal angle, MathContext mathContext); static BigComplex valueOfPolar(double radius, double angle, MathContext mathContext); static final BigComplex ZERO; static final BigComplex ONE; static final BigComplex I; final BigDecimal re; final BigDecimal im; }
@Test public void testHashCode() { assertEquals(BigComplex.ZERO.hashCode(), BigComplex.ZERO.hashCode()); assertEquals(BigComplex.ONE.hashCode(), BigComplex.ONE.hashCode()); assertEquals(BigComplex.I.hashCode(), BigComplex.I.hashCode()); assertNotEquals(BigComplex.ZERO.hashCode(), BigComplex.ONE.hashCode()); assertNotEquals(BigComplex.ONE.hashCode(), BigComplex.I.hashCode()); assertNotEquals(BigComplex.I.hashCode(), BigComplex.ZERO.hashCode()); }