dcsimg
Login | Register   
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.


Tip of the Day
Language: Java Language
Expertise: Beginner
May 5, 2000

WEBINAR:

On-Demand

Application Security Testing: An Integral Part of DevOps


A HashMap of HashMaps

Question:
I have been looking everywhere for information on HashMaps, particularly how to put one hash map into another HashMap.

Answer:
This is where the expression RTFM (Read That Fine Manual) comes to mind. Although notorious for being extremely sparse in certain sections, the javadoc API documentation that comes with the Java 2 Platform SDKs is extremely helpful in describing the use of the HashMap class. I cannot overstate how useful it is to have a Web browser opened to the API docs at all times when writing Java programs.

In short, HashMap is a reimplementation of the Hashtable class to work with the Java 2 Collections Framework. Unlike Hashtable, none of its methods are synchronized. A HashMap associates a value with an arbitrary key. These associations are created with the put(Object key, Object value) method. An association can be removed with remove(Object key). Any object can be stored as a value , including a HashMap. To store one HashMap into another, simply use it as the value argument to put().

DevX Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
×
We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.
Thanks for your registration, follow us on our social networks to keep up-to-date