Java Collection:Collection framework:Less bucket is good to store object in collection or large number of bucket? [closed]

StackOverflow https://stackoverflow.com/questions/21474608

Question

Here i just want to ask one question which i faced in Java interview. Question was like how hashmap works.I explained and answered all following questions.But i stuck at one question,which was: Is it better to have more bucket of objects in collection or less bucket?and why? Please help me here with your view

Was it helpful?

Solution

Best HashMap = Unique Ids - one bucket for one object - fastest access to object when you know the key.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top