How to implement Hash Map?

Answers were Sorted based on User's Feedback



How to implement Hash Map?..

Answer / 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

How to implement Hash Map?..

Answer / brijendra-java (xavient)

HashMap is the implementaion of Map interface.
HashMap is key value pair storage concept.
HasMap does not allow duplicate key but value may be any
thing.
HasMap allow both key and Valuea as NULL.
HasMap is the Unordered collection.
When we change the iteration of HasMap then it give
concurrent Modification error.
HasMap is NonSyncronised class.

HashMap hMap = new HashMap();
hMap.put(Null, Null);
hMap.put(1, a);
hMap.put(2, b);
hMap.put(3, c);
system.out.println("Size"+hMap.size());

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Java Related AllOther Interview Questions

explain how java se 8 data and time api solves issues of old java date api?

0 Answers  


What are the benefits of a jar file?

0 Answers  


What is ioexception in java?

0 Answers  


what is constructer?what are the type of constructer with example.

6 Answers  


Is php faster than java?

0 Answers  






What is meant by annotations in java?

0 Answers  


can anyone tell me what kind of questions are asked for core java exam in aptech

0 Answers  


What is meant by framework in java?

0 Answers  


Can I have multiple main methods in the same class?

0 Answers  


How do I enable java in firefox?

0 Answers  


What is a java executable jar file?

0 Answers  


In java thread programming, which method is a must implementation for all threads?

0 Answers  


Categories