Skip to content

Commit 3f0ea83

Browse files
authored
Merge pull request #1060 from rubenporras/putIfAbsent
avoid get/put in favour of putIfAbsent
2 parents 2798e46 + 3aba3a7 commit 3f0ea83

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

com.avaloq.tools.ddk.xtext/src/com/avaloq/tools/ddk/xtext/scoping/AbstractRecursiveScope.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,11 @@ public synchronized IEObjectDescription getSingleElement(final QualifiedName nam
142142
while (result == null && contentsIterator.hasNext()) {
143143
result = contentsIterator.next();
144144
QualifiedName thisName = result.getName();
145-
if (isIgnoreCase()) {
146-
thisName = thisName.toLowerCase(); // NOPMD UseLocaleWithCaseConversions
147-
}
148-
if (!isIgnoreCase() || nameCache.get(thisName) == null) {
145+
if (!isIgnoreCase()) {
149146
nameCache.put(thisName, result);
147+
} else {
148+
thisName = thisName.toLowerCase(); // NOPMD UseLocaleWithCaseConversions
149+
nameCache.putIfAbsent(thisName, result);
150150
}
151151
if (!lookupName.equals(thisName)) {
152152
result = null; // NOPMD NullAssignment

0 commit comments

Comments
 (0)