Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

A code to print the keys from two different hashMap having same values

 
sinchan banerje
Greenhorn
Posts: 7
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Here a is HashMap1 and b is HashMap2 , the elements displaced are keys of common values depending upon the input given...
 
Nitin Surana
Ranch Hand
Posts: 129
Java Netbeans IDE Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I guess you are trying to put the common values from 2 maps into another map. Is that what you are trying to do?
 
Campbell Ritchie
Sheriff
Posts: 48402
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch
As you have already been told you can use a second map. You can use the values in the first map as keys in the second map, and lists of the keys in the first map as values in the second map.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic