Java中map.getOrDefault()方法的使用 Map.getOrDefault(Object key, V defaultValue)方法的作用是: 当Map集合中有这个key时,就使用这个key值; 如果没有就使用默认值defaultValue。 hashMap中会经常使用到