Your recipient explicitly returns you an UnmodifiableCollection , which is a sort wrapper around Set that prevents modification.
In other words, the API tells you: "This is my collection, please look, but donβt touch!"
If you want to change it, you must copy it to a new set. There are HashSet copy constructors for this purpose.
Steven schlansker
source share