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 Observer Design Pattern in Java ?

What is the Reason to Organize Classes and Interfaces in a Packag ...

Why Should You Define a Default Constructor in Java ?

What is the Reason For Overriding equals Method in Java ?

What are the Java Collection Classes That Implement List Interfac ...