-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[fix][java-client] Returns immutable data set when use TableView. #14833
Conversation
Can we use |
pulsar-client/src/main/java/org/apache/pulsar/client/impl/TableViewImpl.java
Outdated
Show resolved
Hide resolved
My first version is using immutable set like |
Change to immutable set |
Fixes #14821
Master Issue: #14821
Motivation
Currently TableViewImpl methods that access the underlying map, e.g., TableViewImpl::KeySet() (https://github.com/apache/pulsar/blob/master/pulsar-client/src/main/java/org/apache/pulsar/client/impl/TableViewImpl.java#L141) returns views of the underlying map, which means users could modify the returned value and accidentally change the internal state of TableViewImpl.
It's better to return an immutable set to users.
Documentation
no-need-doc