Fix Multihash.Type.hashCode()
Given that Multihash.hashCode() invokes Multihash.hashCode(), and e.g. https://madhead.me/posts/enums-fuckup/, this seems more appropriate.
Do I understand correctly that the same Multihash object may have different hash codes in two different JVM instances of the same version? Because if you aim for hash code stability across different JVM versions, I'm afraid it isn't guaranteed even for String.
Do I understand correctly that the same
Multihashobject may have different hash codes in two different JVM instances of the same version? Because if you aim for hash code stability across different JVM versions, I'm afraid it isn't guaranteed even forString.
This proposes to use the (stable) index, not String, for Type; and for Multihash there's no String. Or did I misunderstand your comment?
Merge this as-is?
AFAIK the exact algorithm of calculating the hash code is not part of the Java specification, even for common types such as String or Integer. My point was that it's probably impossible to guarantee that the hash code of the same object will stay the same across different JVM instances in the general case.
That said, I don't object to merging this PR.