I am trying to convert a Python script I wrote to Java. In the script I am using python's native hash() function on strings. I need to find the exact equivalent of this in Java to avoid discrepancies. Thanks in advance!
The Python method hash(object)
calls
__hash__()
method of an object which are set by default for any object.
The exact equivalent in Java to that is Objects.hashCode(Object)
that calls hashCode()
on the given object and returns the result.
The equivalence is given by the syntax. It may not be given by the underlying hashing algorithm.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.