This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes addition of two Hash maps Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "addition of two Hash maps" Watch "addition of two Hash maps" New topic
Author

addition of two Hash maps

sirisha makkapati
Ranch Hand

Joined: Dec 10, 2006
Posts: 83
I am having two hash Maps ,?How can I add those two

for Example:

HashMap h1=new HashMap();
h1.add("1997","300");
h2.add("1998","400);

HashMap h2=new HashMap();
h2.add("1997","200");
h2.add("1998","700");

HashMap Total=new HashMap();
I want the resultant HshMap like this
total={(997,500),(1998,1100)};

Any one please give me the code

Tanks&& Regards,
Sireesha
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 13872
    
  10

"Any one please give me the code"

Did you think about the problem yourself? What do you think you would need to do to perform this task? Please think about the problem yourself first, when you have thought out how to do it write some code, and if you get stuck post your code here and ask a question about what you don't understand.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: addition of two Hash maps
 
Similar Threads
hashtable working & overriding equals
HashMap in HashMap Doubts
how object.clone() is different then direct reference assignment
hash code
comparing keys of two hashmaps