Re: [java.util.Map] How can I alter a java.util.Map while I am iterating it

2006-03-24 Thread vijay venkataraman
Yes as said, you should not be doing this. Probably fix it at source. But you can certaing look at this. public class CapsKeyMap { public static void main(String[] args) { Map lcMap = new HashMap(); lcMap.put("one","ONE"); lcMap.put("two","TWO"); lcMap.put

Re: [java.util.Map] How can I alter a java.util.Map while I am iterating it

2006-03-23 Thread Antonio Petrelli
temp temp ha scritto: I get this Map from a collection and collection might have 1000 or more Maps so I first iterate over this collection retrieve the map and then iterate over this map so creating a new Map for each iteration is this a good design ? Surely it is not a good design,

Re: [java.util.Map] How can I alter a java.util.Map while I am iterating it

2006-03-23 Thread temp temp
I get this Map from a collection and collection might have 1000 or more Maps so I first iterate over this collection retrieve the map and then iterate over this map so creating a new Map for each iteration is this a good design ? Thanks & Regards Antonio Petrelli <[EMAIL PROTECTED]> wro

Re: [java.util.Map] How can I alter a java.util.Map while I am iterating it

2006-03-23 Thread Antonio Petrelli
temp temp ha scritto: I have a HashMap with some data .I must alter the Map by replacing the keys with their upper case. Ok first of all you cannot modify a HashMap while you are iterating it. But your problem has a solution. Iterate the map and store into another map the key-value pair

[java.util.Map] How can I alter a java.util.Map while I am iterating it

2006-03-23 Thread temp temp
I have a HashMap with some data .I must alter the Map by replacing the keys with their upper case. Map searchResultMap= (Map)request.getAttribute("searchResults"); ListIterator searchResultMapIte=Arrays.asList(searchResultMap.keySet().toArray()).list