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 Use of Jsp:useBean in JSP ?

What are the Different Types of Classloaders in Java ?

How Does hashCode Method Work in Java ?

What is the Use of Run Time Polymorphism in Java ?

Java How To Find The Average Of 10 Numbers Using A While Loop