This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-scxml.git
The following commit(s) were added to refs/heads/master by this push: new 5420486 Use modern Map API 5420486 is described below commit 54204868d34208e0b02843bcf476123534841c68 Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Sat Jul 8 10:59:16 2023 -0400 Use modern Map API --- src/main/java/org/apache/commons/scxml2/SCInstance.java | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/main/java/org/apache/commons/scxml2/SCInstance.java b/src/main/java/org/apache/commons/scxml2/SCInstance.java index f417e6a..5a1e839 100644 --- a/src/main/java/org/apache/commons/scxml2/SCInstance.java +++ b/src/main/java/org/apache/commons/scxml2/SCInstance.java @@ -484,12 +484,11 @@ public class SCInstance implements Serializable { * @return The context. */ public Context getContext(final EnterableState state) { - Context context = contexts.get(state); - if (context == null) { + return contexts.computeIfAbsent(state, k -> { + Context context; if (singleContext) { context = getGlobalContext(); - } - else { + } else { final EnterableState parent = state.getParent(); if (parent == null) { // docroot @@ -499,12 +498,11 @@ public class SCInstance implements Serializable { } } if (state instanceof TransitionalState) { - final Datamodel datamodel = ((TransitionalState)state).getDatamodel(); + final Datamodel datamodel = ((TransitionalState) state).getDatamodel(); cloneDatamodel(datamodel, context, evaluator, errorReporter); } - contexts.put(state, context); - } - return context; + return context; + }); } /**