获取UnsupportedOperationException

时间:2019-03-16 18:51:26

标签: java maven

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);
    }
 }

在这种方法中,我尝试添加一个对象,即object1,但是在行java.lang.UnsupportedOperationException上获得了listOfActivities.add(object1);

我应该如何解决?

0 个答案:

没有答案