Map的读取

private  Map<String,Object> map=new HashMap<String,Object>();

map.put("name",names);

Map d=p.getAllSearch("市");

if (d!=null) {

    Set entries = d.entrySet();

    Iterator item=entries.iterator();

    while (item.hasNext()) {

        Map.Entry entry =(Entry) item.next();

        String key = (String) entry.getKey();

      System.out.println(key+"  ");

}

    for (Iterator iterator = d.values().iterator(); iterator.hasNext();) {

     System.out.println(iterator.next());

}

}

你可能感兴趣的:(集合Map)