Solved

hash table to hash map

Posted on 2003-12-11
6
343 Views
Last Modified: 2010-03-31
How to convert
java.util.HashTable to java.util.HashMap

eg
I have
HashMap hashMap = new HashMap();
Hashtable hashtable = new Hashtable();

hashMap = hashTable????
0
Comment
Question by:applekanna
  • 3
  • 2
6 Comments
 
LVL 92

Expert Comment

by:objects
Comment Utility
hashMap = new HashMap(hashtable);
0
 
LVL 3

Author Comment

by:applekanna
Comment Utility
hashMap.putValues(hashTable)  is this correct ....
0
 
LVL 92

Accepted Solution

by:
objects earned 30 total points
Comment Utility
Should be hashMap.putAll(hashtable).
0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
LVL 4

Assisted Solution

by:tapasvi
tapasvi earned 20 total points
Comment Utility
objects is right.
but one note here..you may need to synchronize hashmap externally if your application need threadsafety. (of course, in that case u wouldnt have dumped hashtable in first place...but some ppl dont use hashtable at all ..as they believe its not "true" collection..
anyways choice is yours)
0
 
LVL 3

Author Comment

by:applekanna
Comment Utility
Thx for ur help :)
0
 
LVL 92

Expert Comment

by:objects
Comment Utility
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
This video teaches viewers about errors in exception handling.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now