'Alternative for Collections.unmodifiableSet
So, I have a class containing a Set and I want to return a read only version of it.
One way would be to use Collections.unmodifiableSet(set).
But this creates a new instance of UnmodifiableSet internally which I think is a cost concern
What alternative do we have in java
PS: I have looked for similar question on stackoverflow, could not find one.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
