Skip to content

Commit

Permalink
Eliminate use of getOrDefault (#10565)
Browse files Browse the repository at this point in the history
* Eliminate use of getOrDefault
  • Loading branch information
larry-safran authored Sep 19, 2023
1 parent 7d9b76e commit 0c415e8
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions util/src/main/java/io/grpc/util/MultiChildLoadBalancer.java
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,10 @@ protected Map<Object, ChildLbState> createChildLbMap(ResolvedAddresses resolvedA
Object policyConfig = resolvedAddresses.getLoadBalancingPolicyConfig();
for (EquivalentAddressGroup eag : addresses) {
EquivalentAddressGroup strippedEag = stripAttrs(eag); // keys need to be just addresses
ChildLbState childLbState = childLbMap.getOrDefault(strippedEag,
createChildLbState(strippedEag, policyConfig, getInitialPicker()));
childLbMap.put(strippedEag, childLbState);
if (!childLbMap.containsKey(strippedEag)) {
childLbMap.put(strippedEag,
createChildLbState(strippedEag, policyConfig, getInitialPicker()));
}
}
return childLbMap;
}
Expand Down

0 comments on commit 0c415e8

Please sign in to comment.