jonyangx commented on code in PR #2848:
URL:
https://github.com/apache/incubator-eventmesh/pull/2848#discussion_r1063977200
##########
eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/recommend/EventMeshRecommendImpl.java:
##########
@@ -226,15 +228,16 @@ private String recommendProxy(final Map<String, String>
eventMeshMap,
log.info("eventMeshMap:{},clientDistributionMap:{},group:{}",
eventMeshMap, clientDistributionMap, group);
}
- if
(!eventMeshMap.keySet().containsAll(clientDistributionMap.keySet())) {
+ Set<String> clientdDistributionSet=new
HashSet<>(clientDistributionMap.keySet());
+ clientdDistributionSet.retainAll(eventMeshMap.keySet());
Review Comment:
public boolean removeAll(Collection<?> c) {
Objects.requireNonNull(c);
boolean modified = false;
Iterator<?> it = iterator();
while (it.hasNext()) {
if (c.contains(it.next())) {
it.remove();
modified = true;
}
}
return modified;
}
The removeAll method also uses iterator() , and use remove operation. Why
not use containAll directly?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]