What have you tried so far? The program you posted puts key/value pairs into a HashMap, where both the key and the value are String's.
Have you tried putting a key value pair into a HashMap the uses a Stirng as a key and another HashMap as its associated value?
If you have, what problems did you encounter?
Oh, by the way, welcome to Javaranch!
Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life.
harikrishnan venkatesan wrote:Its Working Properly........... I need nested hashmap program(hashmap of hashmap).
Any particular reason? It seems like quite an odd structure to me. A HashMap of Lists on the other hand....
Can anyone update this program to nested hashmap java program............
'Fraid that's not how it works here. You need to ShowSomeEffort (←click) and try it yourself first; then come back if you have any problems.
I will give you a piece of advice though:
Get used to declaring the types of your maps and collections. For example, the Map you've described should be a
HashMap<String, String>, not just a
HashMap so it looks like you'll need to declare a
HashMap<<K, HashMap<String, String>>, where 'K' is the type of key you decide on for your "outer" Map.
I also think it might be better to back up and describe what you want, rather than how you want to do it.
Is this some sort of Multimap?
Isn't it funny how there's always time and money enough to do it WRONG?