I have a collection c1<MyClass>
and an array a<MyClass>
. I am trying to convert the array to a collection c2
and do c1.removeAll(c2)
, But this throws UnsupportedOperationException
. I found that the asList()
of Arrays class returns Arrays.ArrayList
class and the this class inherits the removeAll()
from AbstractList()
whose implementation throws UnsupportedOperationException
.
Myclass la[] = getMyClass();
Collection c = Arrays.asList(la);
c.removeAll(thisAllreadyExistingMyClass);
Is there any way to remove the elements? please help