Give the scenario where hashtable and hashmap is use ?

Showing Answers 1 - 21 of 21 Answers

pradeep

  • Nov 7th, 2006
 

 hi ,

this is pradeep.

accroding the question the two are used for storing in terms of object with a key.

in some situations u may need to synchronize the paticular objetct so we use hashtable.

in some situations u may need to unsynchronize and  the paticular objetct so we use hashmap.dis is more faster than hashtable(with respective performance).

  Was this answer useful?  Yes

ramakrishnareddy

  • Nov 10th, 2006
 

hi this is ramakrishnareddy i want to tell about difference between hashtable and hash map.hashtable: hash table is synchronized,some legacy methods are there in hash tablehashmap: hash map is unsynchronized.i this legacy methods are not theresynchronized: this keyword is used to locking functions

  Was this answer useful?  Yes

kishan

  • Nov 16th, 2006
 

1.hash table is 10% faster than hashmap

2.hashtable does nt allows null values where as hash map allows null vaues

3.hash map is unsynchronized,where as hash table is synchronized 

  Was this answer useful?  Yes

Avitra

  • Nov 23rd, 2006
 

hashtable is used when an object  need to be Synchronized and null values should not be accepted,where as hashmap is used when don't  need synchronization & null values can be accepted. 

  Was this answer useful?  Yes

Avitra

  • Nov 23rd, 2006
 

hashtable is used when an object  need to be Synchronized and null values should not be accepted,where as hashmap is used when do

  Was this answer useful?  Yes

tarunarora

  • Dec 2nd, 2006
 

Hi...to understand the basic difference b/w the two..u shd know something abt synchronization...n im assuming u upderstand synchronization in java...Scenario can be a very simple one...consider P2P (Peer to peer ) download programs...Say ur downloading a file from 4 peers...i.e. 4 threads are concurrently downloading data for u...now u shd have a global variable in ur program to store the data downloaded by these 4 threads...n its necessary that the access to this bariable shd be synchronized...bcos if two or more threads try to write their data in this variable at the same time...the state of the variable will be corrupted....so in this case u shd use a Vector or Hashtable which have their methods synchronized..i.e at a time only one thread can access the Hashtable variable...but u cannot use Hasmap over here as it is not synchronized and using this in this scenario can result in corrupted data.....thnx. Hope the scenario was a gud one..:)

Saurav

  • Jan 5th, 2017
 

Hi,
The question is not about HashTable or HashMap.The question is about technical or business scenario where
hash based implementation can be used.So rather than copy paste from internet please suggest something concrete if you really have worked on.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions