HashMap map = new HashMap();map.put("test1", "aaaa");map.put("test2", "bbbb");map.put("test3", "cccc");for (String key : map.keySet()) {//获取所有keySystem.out.println(key);}for (String value : map.values()) { //获取所有valueSystem.out.println(value);}