I’ve read about hash and HashMap coming from here: https://howtodoinjava.com/java/collections/hashmap/design-good-key-for-hashmap/
In particular:
//Depends only on account number
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + accountNumber;
return result;
}
Why the hash code is calculated with prime * result + accountNumber
and not only from accountNumber
What meaning has the fixed value prime * result? Why not just prime (result value is 1 so prime time 1 is prime)?