Friday, 14 October 2011

UnsupportedOperation exception thrown while adding elements

I was working with my code and found that adding an element into Collection thrown UnsupportedOperationException.
Lets say Class A contains a list of object X as its member, so adding new object X to list of Object x like
A a;
a.getXList().add(new X()) throws UnsupportedOperationException.

Why is it so?