diff --git a/matsim/src/main/java/org/matsim/utils/objectattributes/attributeconverters/StringConverter.java b/matsim/src/main/java/org/matsim/utils/objectattributes/attributeconverters/StringConverter.java index 3a600e82bc1..bf9a209818a 100644 --- a/matsim/src/main/java/org/matsim/utils/objectattributes/attributeconverters/StringConverter.java +++ b/matsim/src/main/java/org/matsim/utils/objectattributes/attributeconverters/StringConverter.java @@ -31,14 +31,10 @@ */ public class StringConverter implements AttributeConverter { private final Map stringCache = new ConcurrentHashMap<>(1000); + @Override public String convert(String value) { - String s = this.stringCache.get(value); - if (s == null) { - s = value; - this.stringCache.put(s, s); - } - return s; + return stringCache.computeIfAbsent(value, k -> k); } @Override