diff options
author | Geir Storli <geirst@oath.com> | 2018-03-06 13:03:32 +0100 |
---|---|---|
committer | Geir Storli <geirst@oath.com> | 2018-03-06 13:03:32 +0100 |
commit | 458c88dc28db1a7cbff43c27a4c782ef0b8c9f93 (patch) | |
tree | 21fcd34109a35ec8d397ec5cc9d9f18b9526c057 | |
parent | 0096511340a00ccb92960b06f8e434f9d5f19900 (diff) |
Use computeIfAbsent() instead of explicit get() and put().
-rw-r--r-- | clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/EventDiffCalculatorTest.java | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/EventDiffCalculatorTest.java b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/EventDiffCalculatorTest.java index 2b44adfba9d..743fddcf48b 100644 --- a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/EventDiffCalculatorTest.java +++ b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/EventDiffCalculatorTest.java @@ -82,12 +82,7 @@ public class EventDiffCalculatorTest { return this; } private static AnnotatedClusterState.Builder getBuilder(Map<String, AnnotatedClusterState.Builder> derivedStates, String bucketSpace) { - AnnotatedClusterState.Builder result = derivedStates.get(bucketSpace); - if (result == null) { - result = new AnnotatedClusterState.Builder(); - derivedStates.put(bucketSpace, result); - } - return result; + return derivedStates.computeIfAbsent(bucketSpace, key -> new AnnotatedClusterState.Builder()); } List<Event> computeEventDiff() { |