Mapを巡る<br>>

1357 ワード



public class Main  {
    public static void main(String[] args) {
        Map <Integer, Map <String, List>> classAmount = new HashMap <Integer, Map <String, List>>();
         Map<String,List> m = new HashMap<String,List>();
         List l = new ArrayList();
         l.add("haha");
         m.put("1", l);
        classAmount.put(1, m);
        Set<Entry<Integer, Map<String, List>>> set = classAmount.entrySet();
        Iterator<Entry<Integer, Map<String, List>>>  i = set.iterator();
        while(i.hasNext()) {
            Entry e = i.next();
            Map<String,List> map = (Map<String, List>) e.getValue();
            Set<Entry<String,List>> s = map.entrySet();
            Iterator<Entry<String,List>> inner = s.iterator();
                while(inner.hasNext()) {
                    List list = (List)inner.next().getValue();
                    Iterator li = list.iterator();
                    while(li.hasNext()) {
                        System.out.println(li.next());
                    }
                }
        }
    }
}