The HashMap docs say: “This class makes no guarantees as to the order of the map; in particular, it does not guarantee that the order will remain constant over time.” This utility function depends on the order of the entries, so it can return different hashes even when the keys and values in the map are the same.<p><a href="https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.html" rel="nofollow">https://docs.oracle.com/javase/8/docs/api/java/util/HashMap....</a>