I am having some values stored in a linked hash map. They are in the form of Key value pair.But since I had to maitain their order also I used a LinkedHashMap.
My problem is that while iterating I have to remove a particular value fromt the linkedhashmap. For eg:
the linked hashmap contains the following values:--
("Am",1); ("Pm",2); ("Cm",3); ("Dm",4);
Now suppose I remove Pm. Then the new hashmap should be formed in the following manner ("Am",1); ("Cm",2); ("Dm",3);
Can someone suggest me how to do this. I tried iterating and removing and putting the value again in the linkedhashmap.but it gives a Concurrent modification exception.
Thanks a lot for all your help
Arjun Shastry
Ranch Hand
Joined: Mar 13, 2003
Posts: 1854
posted
0
Are you trying to do this or am I wrong somehere? following code is not giving any error
MH
pascal betz
Ranch Hand
Joined: Jun 19, 2001
Posts: 547
posted
0
hi
it looks like your value is just the index ? then use a List instead of Map. The index of your objects would be the same as your values in the Map.
some pseudocode:
pascal
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.