java – Map. Add / addall operation not supported by keyset()
•
Java
About the map < K, V > interface:
Why does keyset () return a set that supports the remove operation but does not support the add () and addall () operations?
Solution
The set returned by keyset is supported by map, so the change to the map is correct
Calling add or addall on this set is meaningless because you cannot add key [S] to the map without the corresponding value [S]
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码