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 ?

What is a Singleton Class in Java ?

How Will You Sort Objects by Natural Order in a Java List ?

How Can We Find the Memory Usage of JVM From Java Code ?

What are the Similarities Between HashSet and HashMap in Java ?