一,集合篇
- hashmap的使用,要进行初始化容量,公式为希望的map大小/0.75+1
- map的遍历要使用entrySet,而不是使用keyset
/** * 最常见也是大多数情况下用的最多的,一般在键值对都需要使用 */ Map <String,String>map = new HashMap<String,String>(); map.put("熊大", "棕色"); map.put("熊二", "黄色"); for(Map.Entry<String, String> entry : map.entrySet()){ String mapKey = entry.getKey(); String mapValue = entry.getValue(); System.out.println(mapKey+":"+mapValue); } 9
-----待拓展