-
Notifications
You must be signed in to change notification settings - Fork 195
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
Unmodifiable map wrappers to not shield from Entry.setValue() #244
Comments
Why doesn't giving the raw entry/keySet to unmodifiableSet and then returning that work? |
Because making an entry set unmodifiable simply means that you cannot add or remove entries. It does not prevent you from reading an entry and invoking setValue(), thus modifying the underlying collection. Key sets and value collections do not have this problem. |
Ah, I see. Would require some care, but we won't have to implement a whole wrapper from scratch. |
The current way entrySet() is handled in unmodifiable wrapper is wrong—users can still modify the map using Entry.setValue(). An entirely custom unmodifiable wrapper is necessary (as the JDK does).
The text was updated successfully, but these errors were encountered: