You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ws.apache.org by ve...@apache.org on 2021/11/26 22:07:19 UTC

[ws-axiom] branch master updated: Use computeIfAbsent

This is an automated email from the ASF dual-hosted git repository.

veithen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ws-axiom.git


The following commit(s) were added to refs/heads/master by this push:
     new 7af7c99  Use computeIfAbsent
7af7c99 is described below

commit 7af7c999a20102184d079d7023401126dcc42af0
Author: Andreas Veithen <an...@gmail.com>
AuthorDate: Fri Nov 26 22:07:10 2021 +0000

    Use computeIfAbsent
---
 axiom-weaver/src/main/java/org/apache/axiom/weaver/Weaver.java | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/axiom-weaver/src/main/java/org/apache/axiom/weaver/Weaver.java b/axiom-weaver/src/main/java/org/apache/axiom/weaver/Weaver.java
index 5f7feda..622806f 100644
--- a/axiom-weaver/src/main/java/org/apache/axiom/weaver/Weaver.java
+++ b/axiom-weaver/src/main/java/org/apache/axiom/weaver/Weaver.java
@@ -57,13 +57,9 @@ public final class Weaver {
     }
 
     private void addMixin(Mixin mixin) {
-        Class<?> iface = mixin.getTargetInterface();
-        Set<Mixin> mixins = mixinsByInterface.get(iface);
-        if (mixins == null) {
-            mixins = new HashSet<>();
-            mixinsByInterface.put(iface, mixins);
-        }
-        mixins.add(mixin);
+        mixinsByInterface
+                .computeIfAbsent(mixin.getTargetInterface(), k -> new HashSet<>())
+                .add(mixin);
     }
 
     private InterfaceNode addInterface(Class<?> iface) {