Some hash table schemes, such as cuckoo hashing or dynamic perfect hashing, rely on the existence of universal hash functions and the ability to take a collection of data exhibi
I think the normal hashCode
method was created without the "malicious inputs" case in mind. Also, as written by larsmann, its contract is much more easier to understand and implement than a universal hash function would be.
Here an idea about what to do: