How is hashmap different from hashtable?

0 votes
I cannot differentiate between the two terminologies Hashmap and Hashtable.
Apr 16, 2018 in Java by Akrati
• 3,150 points
464 views

2 answers to this question.

Your answer

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


Here are few differences between HashMap and HashTable:

  • HashMap is non synchronized whereas HashTable is synchronized.
  • HashMap is fast whereas HashTable is slow
  • HashMap allows one null key and multiple null values whereas HashTable doesn't allow any null value or key.
  • HashMap inherits AbstractMap class whereas HashTable inherits Dictionary class.
  • HashMap is traversed by Iterator whereas HashTable is traversed by Enumerator and Iterator.

answered Apr 16, 2018 by anonymous
0 votes

HashMap and HashTable:

1) Hashtable and Hashmap implement the java.util.Map interface

2) Both Hashmap and Hashtable is the hash-based collection. and working on hashing. so these are similarity of HashMap and HashTable.

  • What is the difference between HashMap and HashTable?

1) The first difference is HashMap is not thread safe While HashTable is ThreadSafe
2) HashMap is performance wise better because it is not thread safe. while Hashtable performance wise is not better because it is thread safe. so multiple thread cannot access Hashtable at the same time.

answered Aug 1, 2018 by samarth295
• 2,190 points

Related Questions In Java

0 votes
1 answer

Is it possible to run a java program from command line on windows?How?

  Let's say your file is in C:\myprogram\ Run ...READ MORE

answered Apr 18, 2018 in Java by sophia
• 1,400 points
68 views
0 votes
1 answer

How is inheritance in C++ different than that in Java?

The purpose of inheritance is same for ...READ MORE

answered Feb 6 in Java by Priyaj
• 56,140 points
28 views
0 votes
1 answer

How to take input from users?

Scanner Class is used to take input ...READ MORE

answered Apr 17, 2018 in Java by Akrati
• 3,150 points
22 views
0 votes
3 answers

How to read input from Console using Scanner Class?

A simple example: import java.util.Scanner; public class Expl { ...READ MORE

answered Jul 31, 2018 in Java by samarth295
• 2,190 points
177 views
0 votes
1 answer

Good Hash Function for Strings

Usually hashes wouldn't do sums, otherwise, stop and pots will have ...READ MORE

answered Jul 19, 2018 in Java by Akrati
• 960 points
54 views
+5 votes
3 answers

How to execute a python file with few arguments in java?

You can use Java Runtime.exec() to run python script, ...READ MORE

answered Mar 27, 2018 in Java by DragonLord999
• 8,380 points

edited Nov 6, 2018 by Omkar 5,483 views
0 votes
1 answer

How to handle drop downs using Selenium WebDriver in Java

First, find an XPath which will return ...READ MORE

answered Mar 27, 2018 in Selenium by nsv999
• 5,050 points
1,447 views
0 votes
1 answer

What are the differences between getText() and getAttribute() functions in Selenium WebDriver?

See, both are used to retrieve something ...READ MORE

answered Apr 5, 2018 in Selenium by nsv999
• 5,050 points
3,947 views
0 votes
3 answers

Is it possible to take char input from scanner?

// Use a BufferedReader to read characters ...READ MORE

answered Sep 7, 2018 in Java by Daisy
• 8,040 points
725 views
0 votes
1 answer

How to build jars from IntelliJ properly?

How to build a jar with IntelliJ ...READ MORE

answered Oct 12, 2018 in Java by sharth
• 3,310 points
45 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.