map集合的遍历的几种方式

       Map集合的遍历:

publicstaticvoid main(String[]args) {

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

       map.put("e_便利店+(k_|k_)", "13_005_005");

       Set<String> cons = map.keySet();

       for(String everyCon:cons){

           System.out.println(everyCon+"!!"+map.get(everyCon));

       }

       Iterator<String>it=cons.iterator();

       while(it.hasNext()){

           Stringkey=it.next();

           System.out.println(key+">>"+map.get(key));

       }

    }

你可能感兴趣的:(java)