How should I map long to int in hashCode()?
Since Java 8 you can use Long.hashCode(guid); For older versions of Java you can use the following: Long.valueOf(guid).hashCode(); Note that this solution creates a new Object for the stack, while the first doesn’t (although it is likely that Java optimizes the object creation away..) Looking at the docs, both ways just use the following algorithm: … Read more