What is the difference between Map and HashMap in java?

0 votes
Can you please explain the difference between map and hashmap?

How they are different from each other?
May 31 in Java by sanhati
32 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

Hi Sanhati,

I understand your doubt regarding map and hash map.

Please check out my answer, I hope it will clear your doubts.

Hash map: 

  • It is the implementation of map interface.
  • It can contain null values and keys.
  • It doesn't maintain input order.

Map: 

  • It is an interface
  • Map has two implementation
  1. Tree Map
  2. Hash Map
  • Tree Map maintains the input order .
  • It will not allow any null values.
  • Duplicate keys are not allowed in the map
answered May 31 by Sampriti
• 620 points

Related Questions In Java

0 votes
1 answer

What is the difference between Set and List in java?

List is an ordered sequence of elements. ...READ MORE

answered Apr 26, 2018 in Java by Akrati
• 3,150 points
39 views
0 votes
1 answer

What is the difference between getAttribute() and getParameter() in java?

getParameter() - getParameter will return the value of ...READ MORE

answered Jun 29, 2018 in Java by Perry
• 16,450 points
308 views
0 votes
1 answer

What is the difference between Type List and type ArrayList in Java

Always TypeList is preferred over ArrayList. The ...READ MORE

answered Jul 9, 2018 in Java by Akrati
• 960 points
33 views
0 votes
1 answer

What is the difference between getPath(), getAbsolutePath() and getCanonicalPath() in Java?

getPath() - returns a String which denotes the ...READ MORE

answered Jul 25, 2018 in Java by Mrunal
• 680 points
117 views
0 votes
1 answer

What is the difference == and equals() in Java?

Both the answers (Syntaxes) are correct. If ...READ MORE

answered Jun 5, 2018 in Java by Akrati
• 3,150 points
22 views
0 votes
1 answer

Are arrays equivalent to objects in Java ?

Yes; the Java Language Specification writes: In the Java ...READ MORE

answered May 10, 2018 in Java by Rishabh
• 3,520 points
39 views
0 votes
1 answer

Remove objects from an array in Java?

We can use external libraries: org.apache.commons.lang.ArrayUtils.remove(java.lang.Object[] array, int ...READ MORE

answered Jun 26, 2018 in Java by scarlett
• 1,280 points
28 views
0 votes
1 answer

Performance difference of if/else vs switch statement in Java

The thing you are worried about is ...READ MORE

answered Jul 26, 2018 in Java by geek.erkami
• 2,320 points
242 views
0 votes
1 answer

How to iterate in a HashMap in Java?

You can use for but in a ...READ MORE

answered Dec 4, 2018 in Java by Priyaj
• 56,140 points
34 views
0 votes
1 answer

How to Iterate HashMap?

Hi Shashank. Please try this code I hope ...READ MORE

answered May 30 in Java by Sampriti
• 620 points
14 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.