what happens when we add the objects morethan the size limit
to a hashmap
When the number of entries in the hash table exceeds the
product of the load factor and the current capacity, the
hash table is rehashed (that is, internal data structures
are rebuilt) so that the hash table has approximately twice
the number of buckets.
As a general rule, the default load factor (.75) offers a
good tradeoff between time and space costs. Higher values
decrease the space overhead but increase the lookup cost
(reflected in most of the operations of the HashMap class,
including get and put). The expected number of entries in
the map and its load factor should be taken into account
when setting its initial capacity, so as to minimize the
number of rehash operations. If the initial capacity is
greater than the maximum number of entries divided by the
load factor, no rehash operations will ever occur.
| Is This Answer Correct ? | 3 Yes | 0 No |
What is a line break?
what is meant by abstract class?
How to print an arraylist in java?
What state is a thread in when it is executing?
what is dynamic method dispatch ?
27 Answers Fidelity, MUET, SDSF,
What is the blank final variable?
What is garbage collection? Can it be forced to run?
what is the Arraylist limit (maximum) by default ?
13 Answers Fidelity, PlanetSoft, Wipro,
What is lazy programming?
What is static in java?
What is escape analysis algorithm in JVM and how garbage collection actually worked n how it transfer the objects from one kind of space to other?
How to access arraylist elements in java?