So i am able to write:
HashMap<String, ArrayList<Integer>> ...
but When it comes to a structure like
HashMap<String, HashMap<Integer, ArrayList<Integer>>> ...
I fail...
Set<String> keys = outer.keySet();
List<String> list = sortList(keys);
Iterator<String> it = list.iterator();
HashMap<Integer,ArrayList<Integer>> inner=new HashMap<Integer,ArrayList<Integer>>();
while (it.hasNext()) {
String key = it.next();
Set<Integer> ids= inner.keySet();
List<Integer> positions=sortList(ids);
Iterator<Integer> itIn=positions.iterator();
while(itIn.hasNext()){
String id= it.next();
output.write(key + "\t" + outer.get(key) + " " +inner.get(id) +"\n");
}
}
My code can write all the keys outer has, and first elements of the Integer1 but can not see list or so on.
How can I make a connection with inner hashmap and outer hashmap?
inner
variable, you are instantiating it right now, and you want to iterate over it? That collection is empty, so there can't be no values inside it. – SHiRKiT Jan 15 '12 at 14:56HashMap<String, HashMap<Integer, ArrayList<Integer>>>
things got really complicated. – SHiRKiT Jan 15 '12 at 15:16