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 are the Differences Between Collection and Collections in Ja ...

When Does JVM Call the Finalize Method in Java ?

What is the Advantage of Using Unicode Characters in Java ?

What is the Difference Between Fail-fast and Fail-safe Iterator i ...

What is the Use of Jsp:useBean in JSP ?