• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HashMap putall() use

 
Aneek Banerjee
Ranch Hand
Posts: 61
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 255
2
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hm.putAll(hm1)
putAll hm1 Ma.Entry to hm which hm1 is empty
do you mean hm1.putAll(hm) ?
 
Aneek Banerjee
Ranch Hand
Posts: 61
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Tong.

Exactly my mistake.Now working fine.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic