what happens when we add the objects morethan the size limit
to a hashmap



what happens when we add the objects morethan the size limit to a hashmap..

Answer / kanu butani

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

Post New Answer

More Core Java Interview Questions

What are the different types of inheritance in java?

0 Answers  


What is supplier in java?

0 Answers  


List the interfaces which extends collection interface?

0 Answers  


Explain the significance of listiterator.

0 Answers  


Under what conditions is an object’s finalize() method invoked by the garbage collector?

0 Answers  


What do you mean by the term transient?

5 Answers   Ericsson,


List out five keywords related to exception handling ?

0 Answers  


What is a finally block? Is there a case when finally will not execute?

0 Answers  


briefley expalin about the packages

3 Answers  


From the two, which would be easier to write: synchronization code for ten threads or two threads?

0 Answers  


how to use finalize()Method to resources

4 Answers   TCS,


What do you mean by order of precedence and associativity?

0 Answers  


Categories