map-list

Map map = new HashMap();
  map.put("a", "1");
  map.put("b", "2");
  List list = new ArrayList();
  list.add("3");
  list.add("4");
  map.put("c", list);

  Set set = map.entrySet();
  Iterator it = set.iterator();
  while (it.hasNext()) {
   Entry es = (Entry) it.next();
   if (es.getValue() instanceof java.util.List) {
    List li = (List) es.getValue();
    for (int i = 0; i < li.size(); i++) {
     System.out.println("--->" + li.get(i));
     System.out.println("-key>" + es.getKey());
    }
   } else {
    System.out.println("--->" + es.getValue());
    System.out.println("-key>" + es.getKey());
   }
  }

你可能感兴趣的:(list)