title: java 8 中的computeIfAbsent方法简介
date: 2020-10-21 19:38:26
tags:
java 8 中的computeIfAbsent方法简介
文章目录
-
java 8 中的computeIfAbsent方法简介
-
1) Map.computeIfAbsent 方法
先看函数签名
default V computeIfAbsent(K key, Function<? super K, ? extends V> mappingFunction)
这个computeIfAbsent 方法需要两个参数,第一个参数是keyÿ