merlimat commented on a change in pull request #14833:
URL: https://github.com/apache/pulsar/pull/14833#discussion_r833882242



##########
File path: 
pulsar-client/src/main/java/org/apache/pulsar/client/impl/TableViewImpl.java
##########
@@ -133,17 +133,17 @@ public T get(String key) {
 
     @Override
     public Set<Map.Entry<String, T>> entrySet() {
-       return data.entrySet();
+       return new HashSet<>(data.entrySet());

Review comment:
       Even better: we could keep an `Collections.unmodifiableMap()` as a 
member variable and use it for these methods: 
   
   ```java
   public Set<Map.Entry<String, T>> entrySet() {
       return readOnlyData.entrySet();
   }
   ```
   
   
   
   




-- 
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]


Reply via email to