previous |
start |
next
A hashCode method for the Coin class
- There are two instance fields: String coin name and
double coin value
- Use String's hashCode method to get a hash code for
the name
- To compute a hash code for a floating-point number:
- Wrap the number into a Double object
- Then use Double's hashCode method
- Combine the two hash codes using a prime number as the
HASH_MULTIPLIER
previous |
start |
next