Skip to content

Commit

Permalink
avoid get/put in favour of putIfAbsent
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenporras committed Dec 20, 2024
1 parent 12fccae commit 3aba3a7
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,11 @@ public synchronized IEObjectDescription getSingleElement(final QualifiedName nam
while (result == null && contentsIterator.hasNext()) {
result = contentsIterator.next();
QualifiedName thisName = result.getName();
if (isIgnoreCase()) {
thisName = thisName.toLowerCase(); // NOPMD UseLocaleWithCaseConversions
}
if (!isIgnoreCase() || nameCache.get(thisName) == null) {
if (!isIgnoreCase()) {
nameCache.put(thisName, result);
} else {
thisName = thisName.toLowerCase(); // NOPMD UseLocaleWithCaseConversions
nameCache.putIfAbsent(thisName, result);
}
if (!lookupName.equals(thisName)) {
result = null; // NOPMD NullAssignment
Expand Down

0 comments on commit 3aba3a7

Please sign in to comment.