I have a HashMap with coordinates as keys.
The coordinates have 3 long coordinates x, y and z. (The coordinate is and must be a custom class, the coordinates must be long).
Now I want to have access, for example. Field [5, 10, 4], performing: hashMap.get(new Coordinate(5, 10, 4)).
I applied the equals method, but this is not enough, since, apparently, I also need to implement the hashCode implementation. So my question is: how can I create a unique hash code of three lengths? .
Optional: using a hash generator from an external library is not an option.
source
share