The purpose of the hash methods listed (methods provided by common objects to conform to an interface used by standard collections) is to map all possible values for which a hash is calculated to the full range of valid values of the hash value's type. The randomness used in this mapping is not for security. The mapping must be sufficiently random so that sequences and common patterns will not cause uneven distribution in the use of buckets common to hash based collections.
Hash maps, multimaps, and sets may be used in larger security schemes but, by themselves, are not intended to be secure. They are simply collections designed to provide indexed lookup. Hashes used this way provide much faster indices than binary trees.
The term hashCode is actually misleading in this way. Creating a hash for a string type so that a hash map can be indexed using such a string is not an encoding. The resulting hash value arising from such a hashing algorithm may map back to a large number of object values, but the intention in this context is NOT to hide those object values from an attacker.
In the case of MD5 or SHA hash algorithms used in security protocols, the intention is to create a mathematically low probability of guessing the input value from the hash in any practically achievable number of tries. The methods provided by common objects in these languages so that they may be inserted into collections that index them using buckets should NEVER be used to replace the hash algorithms designed to be used in security protocols.