Ok,

I have a text file like this

------------------
Textfile.txt
comments like these should be skipped
{
<randomItemName>
values of item ;
values of item 2;
}

Comments

{
<randomItemName2>
values of item ;
values of item 2;
}

More comments

----------------------------

So basically I need to parse through the string and first of all skip over all the comments then add any thing in the { } into a hash map like this:

hasmapName.put("<randomitemName>", "values of item ; values of item2 ;");

and put all of them into the hashmap with the key being the randomitemName

I can do it with if statements and switch statements but I'm trying to figure out how to do it with a scanner (which I think would be cleaner code).

Thanks for any help