【发布时间】:2019-03-25 22:20:55
【问题描述】:
我有这段代码:
if (notificationSend.get(key) != null && notificationSend.get(key).equals(value)) {
return true;
} else {
notificationSend.put(key, value);
return false;
}
我想知道是否可以使用 Jav8 增强功能重构它,例如 compute()、computeIfPresent() 或 computeIfAbsent()
【问题讨论】:
标签: java collections java-8 hashmap