I have a list (List list) and I want to index its objects by their ids using a map (HashMap map). I always use list.si
List list
HashMap map
list.si
The rule of thumb if you don't know load factor/capacity internals :
initialCapacityToUse = (Expected No. of elements in map / 0.75) + 1
With this initial capacity value, the rehash will not occur for storing given expected no. of elements in map.