private void createObject(List<Activities> listOfActivities){
ABC object1 = new ABC();
String value = "";
for (Activities list : listOfActivities) {
if (list instanceof XYZ) {
value= ((XYZ) list).getValue();
}
}
object1.setValue(value)
listOfActivities.add(object1);
}
}
In this method I am trying to add one more object, i.e. object1
, but I am getting a java.lang.UnsupportedOperationException
on the line listOfActivities.add(object1);
.
How should I resolve this?