How to implement Hash Map?

Answer Posted / rice


HashMap is a class that implements Map interface.

HashMap underlined data structure is Hash table.

If we want to describe the group of objects as key ,value
pairs then we go for HashMap class.

key are not duplicated but value can be any thing.

null insertion is possible.

insertion order is not preserved.

HashMap hm=new HashMap();
hm.put(1, "rice");
hm.put(3, "rice");
hm.put(2, "shine");
System.out.println(hm);

Is This Answer Correct ?    2 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can I protect myself? : java security

494


What do you understand by a variable?

516


program A and B are analysed and found to have worst case running time greater than 150NlogN and N*N respectively. which program has the better guarantee after the running time for the large values of N(N>10000)? which program has the better guarantee for the running time of small program N (N<100)? which program will run faster on average for N=1000?

1599


What is a uint8?

481


What is jpa used for?

482






What is the difference between swing and awt components?

639


What is gui in java with examples?

473


What is a pojo class in java?

490


Does jvm maintain a cache by itself? Does the jvm allocate objects in heap? Is this the os heap or the heap maintained by the jvm? Why

462


How can you work with permissions from your .net application? : java security

495


What is the meaning of the words public, static and void?

474


Differences between intermediate operations and terminal operations of java 8’s stream api?

481


Why doesn’t the main method throw an error with no arguments?

529


What is dialect in java?

458


What is stateless class in java?

504