diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2022-11-30 10:04:50 +0100 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2022-11-30 10:04:50 +0100 |
commit | 448231f18ba53edf5c0e7ab4b6732ef69328281c (patch) | |
tree | 289f528fd6adac2a39e636c449c633c26fdb838e /config-model-api | |
parent | 711362f17d4bbece0dc2d0833a22063374ae3e04 (diff) |
Reduce the simple usage of guava where java has caught up
Diffstat (limited to 'config-model-api')
-rw-r--r-- | config-model-api/src/main/java/com/yahoo/config/application/api/Notifications.java | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/config-model-api/src/main/java/com/yahoo/config/application/api/Notifications.java b/config-model-api/src/main/java/com/yahoo/config/application/api/Notifications.java index e95527d646a..7955a11ce45 100644 --- a/config-model-api/src/main/java/com/yahoo/config/application/api/Notifications.java +++ b/config-model-api/src/main/java/com/yahoo/config/application/api/Notifications.java @@ -1,7 +1,6 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.config.application.api; -import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; @@ -50,10 +49,10 @@ public class Notifications { return none; ImmutableMap.Builder<When, List<String>> emailAddresses = ImmutableMap.builder(); - emailAddressesByWhen.forEach((when, addresses) -> emailAddresses.put(when, ImmutableList.copyOf(addresses))); + emailAddressesByWhen.forEach((when, addresses) -> emailAddresses.put(when, List.copyOf(addresses))); ImmutableMap.Builder<When, List<Role>> emailRoles = ImmutableMap.builder(); - emailRolesByWhen.forEach((when, roles) -> emailRoles.put(when, ImmutableList.copyOf(roles))); + emailRolesByWhen.forEach((when, roles) -> emailRoles.put(when, List.copyOf(roles))); return new Notifications(emailAddresses.build(), emailRoles.build()); } @@ -122,11 +121,11 @@ public class Notifications { } public static When fromValue(String value) { - switch (value) { - case "failing": return failing; - case "failing-commit": return failingCommit; - default: throw new IllegalArgumentException("Unknown value '" + value + "'."); - } + return switch (value) { + case "failing" -> failing; + case "failing-commit" -> failingCommit; + default -> throw new IllegalArgumentException("Unknown value '" + value + "'."); + }; } } |