If you were creating creating a generic hash table in Java (assume it didn't already have one), then how would you implement its default hash function? I know you can pass one in (via an interface), but most data structures have defaults.
My Attempt:
As Java generics require reference types, and all reference types in Java implement hashCode(), I figured that you could just use T.hashCode() % backingArraySize
as the hash function, and that this would be sufficient. After all, the implementer of any type you may store in the hash table should give their type an appropriate hashCode() function, right?
Is there a better way to do this?