使用 HashMap 的方法 :
computeIfAbsent(K key, Function remappingFunction)其中 remappingFunction 是一個 Functional interface
- input 為 map 的 key
- output 會成為 map 的 value
HashMap 的 computeIfAbsent 方法,在 key 不存在時,會做 remappingFunction 的操作,所以再也不會因為漏寫
if x == null而出現空指針的 bug 了。



