File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes HashMap putall() use Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "HashMap putall() use" Watch "HashMap putall() use" New topic
Author

HashMap putall() use

Aneek Banerjee
Ranch Hand

Joined: Jun 20, 2012
Posts: 61

Hi I have an HashMap and I am trying to copy all the element of that HashMap to another map.Finally I want to itreat through the element of the copied map and printout each element.I have written the below program for this purpose but when I try and run this I am not getting any output.
Please Advice.

Raymond Tong
Ranch Hand

Joined: Aug 15, 2010
Posts: 230
    
    2

hm.putAll(hm1)
putAll hm1 Ma.Entry to hm which hm1 is empty
do you mean hm1.putAll(hm) ?
Aneek Banerjee
Ranch Hand

Joined: Jun 20, 2012
Posts: 61

@Tong.

Exactly my mistake.Now working fine.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: HashMap putall() use
 
Similar Threads
Hash Map question ...
Deep Copying HashMap
What is the "standard way" when getting data from a DB?
Sorting in List<Hash Map>
How to remove duplicates values from HashMap