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 does I ++ mean?

0 Answers  


What is the difference between jvm and jre? What is an interface?

0 Answers  


When can an object reference be cast to an interface reference in java programming?

0 Answers  


string is immutable? right every one knows that, my question is it advantage or disadvantage making string immutable?

5 Answers   HCL,


What is collection api?

0 Answers  






What is numel matlab?

0 Answers  


Why java is secure? Explain.

0 Answers  


what is the difference between object and class

10 Answers   IBM,


what is difference between perfom() & excute() ?

2 Answers   IBM,


Is empty set an element of empty set?

0 Answers  


solve this is my problem byte a=40,byte b=50 both add value is 90 this is with in range of byte... byte range is -128to 127.... why this pgm gives error like type mismatch.... package javapgms; public class byte1 { public static void main(String args[]) { byte a=40,b=50; byte c=a+b; System.out.println(c); } } note : dont use int k... a,b,c are in byte range... mind it..

2 Answers  


What is thread?

7 Answers   BMC, Virtusa,


Categories