Hashcode bucket distribution in java

Viewed 7047

Suppose I need to store 1000 objects in Hashset, is it better that I have 1000 buckets containing each object( by generating unique value for hashcode for each object) or have 10 buckets roughly containing 100 objects?

1 advantage of having unique bucket is that I can save execution cycle on calling equals() method?

Why is it important to have set number of buckets and distribute the objects amoung them as evenly as possible?

What should be the ideal object to bucket ratio?

3 Answers
Related