File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes How to Iterate HashMap of type HashMap<String, ArrayList<String>> Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "How to Iterate HashMap of type HashMap<String, ArrayList<String>>" Watch "How to Iterate HashMap of type HashMap<String, ArrayList<String>>" New topic
Author

How to Iterate HashMap of type HashMap<String, ArrayList<String>>

Anu satya
Ranch Hand

Joined: Mar 17, 2005
Posts: 146
HI,
I am trying to iterate the hash Map. But, I am getting error at "for loop" please help.
I want the each value in the arraylist and do some string manipulation.



Please help

With Regards,
Anu
Jesper de Jong
Java Cowboy
Bartender

Joined: Aug 16, 2005
Posts: 12928
    
    3

First of all, declare your map like this (line 14):

Then you can get rid of the casts in lines 18 and 22.

I tried your code and it worked without errors!

You most likely have a class that you wrote yourself that is called Map, and Java is getting confused, it takes your own class Map instead of the Map from java.util. Rename or delete your own class Map.

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://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: How to Iterate HashMap of type HashMap<String, ArrayList<String>>
 
Similar Threads
How to sort ip addresses?
HashMap values-- I think I know why but how do I fix this null pointer exception?
Reading and writing fixed length file
HashMap dilemma
How can i browse 3 files (same file format, exp: .txt) and process it ?