Skip to content

Commit

Permalink
[java] Minor performance improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
barancev committed Apr 20, 2020
1 parent 66d554a commit 76d4807
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions java/client/src/org/openqa/selenium/remote/ErrorCodes.java
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ public boolean isMappableError(Throwable rootCause) {
// There should be only one canonical JSON Wire protocol code per exception
Map<Object, Set<KnownError>> matched = new HashMap<>();
for (KnownError knownError : KNOWN_ERRORS) {
matched.getOrDefault(knownError, new HashSet<>()).add(knownError);
matched.computeIfAbsent(knownError, key -> new HashSet<>()).add(knownError);
}
for (Set<KnownError> errors : matched.values()) {
if (errors.size() != 1) {
Expand All @@ -278,7 +278,7 @@ public boolean isMappableError(Throwable rootCause) {
// There should only be one canonical W3C code to JSON Wire Protocol code
matched = new HashMap<>();
for (KnownError error : KNOWN_ERRORS) {
matched.getOrDefault(error.getW3cCode(), new HashSet<>()).add(error);
matched.computeIfAbsent(error.getW3cCode(), key -> new HashSet<>()).add(error);
}
for (Set<KnownError> errors : matched.values()) {
if (errors.size() != 1) {
Expand Down

0 comments on commit 76d4807

Please sign in to comment.