```java
public void testMap(){
Map<String,String> map = new HashMap<>();
map.put("1","first");
map.put("2","second");
map.put("3","three");
//输出所有value值
// System.out.println("-----------" + map.values());
//根据遍历key值获取所有value值
// for (String key : map.keySet()){
// String value = map.get(key);
// System.out.println("-----------" + value);
// }
//通过Map.entrySet遍历key和value,容量大时推荐使用
// for (Map.Entry<String, String> entry : map.entrySet()) {
// System.out.println("key= " + entry.getKey() + " and value= " + entry.getValue());
// }
//根据keySet()使用迭代器获取所有value值(性能较低)
// Iterator<String> it = map.keySet().iterator();
// while (it.hasNext()){
// String key = it.next();
// String value = map.get(key);
// System.out.println("-------------" + value);
// }
//根据entrySet()使用迭代器获取所有value值(性能较高)
// Iterator<Map.Entry<String,String>> it = map.entrySet().iterator();
// while (it.hasNext()){
// Map.Entry<String, String> entry = it.next();
// String key = entry.getKey();
// String value = entry.getValue();
// System.out.println(key + "--------" + value);
// }
}