Unsupported add / addAll operations for Map <K, V> .keySet ()
Set returned by keySet is supported by Map , so changes to the map are reflected in the set, and vice versa. This means that calling remove on this Set removes the corresponding Entry from the Map .
It makes no sense to call add or addAll on this Set , since you cannot add the [s] key without the corresponding [s] value in Map .
Think about what you are asking for:
you want to receive all KEYS of the card (and this set is not a βcopyβ of keys, it represents the keys of the card).
And then you ask to add items to these KEYS. In other words: the βdatasetβ that you are viewing has the semantic meaning of the keys coming from the card. And you want to increase this "data set" - but without providing the relevant records for this card.
Removal, on the other hand, is straightforward; deleting a key will also delete the corresponding entry from the card.