Collisions are inevitable when hashing. The hashCode() method returns an integer which is used as an index into an array which is a bucket for all objects with the same hash code. The equals(Object) method is used to compare the target object with each one in the bucket to identify the exactly matching object, if it exists.
Ultimately, the hashCode() method just needs to be fast and not too weak (i.e. causing too many collisions), where too weak is quite a fuzzy metric.