UnsupportedOperationException on Collection

后端 未结 4 975
醉酒成梦
醉酒成梦 2021-02-05 03:13

While studying the Collection API, we find that some methods (add, remove,...) may throw a java.lang.UnsupportedOperationException

4条回答
  •  猫巷女王i
    2021-02-05 03:17

    The obvious examples are the implementations returned from, say, Collections.unmodifiableCollection() and other similar methods. Methods that would change the Collection throw this exception.

提交回复
热议问题