Questions tagged «unsupportedoperation»

7
Java List.add()UnsupportedOperationException
我尝试将对象添加到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(未知源) java.util.AbstractList.add(未知源) javax.servlet.http.HttpServlet.service(HttpServlet.java:641) javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.