java map get if contains else 0 code example Example: java map get if contains else 0 map.put(c, map.getOrDefault(c, 0) + 1);