When is UnsupportedOperationException Thrown in Java ?

In a Java collection UnsupportedOperationException is thrown when the requested operation is not supported by the collection.

It is an unchecked exception that is thrown on optional operations.

If there is an optional add() or remove() methods in a read only collection, then this exception can be thrown.



You May Interest

What is the Purpose of Thread Groups in Java ?

Why Do We Use Nested Classes in Java ?

What are the Uses of Optional in Java ?

What is the Difference Between remove Methods of Collection and I ...

How Will You Implement a Thread Safe JSP Page ?