Java List.add() UnsupportedOperationException
2022-08-31 05:11:51
我尝试将对象添加到实例,但它会抛出一个.有谁知道为什么吗?List<String>
UnsupportedOperationException
我的 Java 代码:
String[] membersArray = request.getParameterValues('members');
List<String> membersList = Arrays.asList(membersArray);
for (String member : membersList) {
Person person = Dao.findByName(member);
List<String> seeAlso;
seeAlso = person.getSeeAlso();
if (!seeAlso.contains(groupDn)){
seeAlso.add(groupDn);
person.setSeeAlso(seeAlso);
}
}
错误消息:
java.lang.UnsupportedOperationException java.util.AbstractList.add(Unknown Source) java.util.AbstractList.add(Unknown Source) javax.servlet.http.HttpServlet.service(HttpServlet.java:641) javax.servlet.http.HttpServlet.service(HttpServlet.java:722)