[转] remove on List created by Arrays.asList throws UnsupportedOperationException_JAVA_编程开发_程序员俱乐部

中国优秀的程序员网站程序员频道CXYCLUB技术地图
热搜:
更多>>
 
您所在的位置: 程序员俱乐部 > 编程开发 > JAVA > [转] remove on List created by Arrays.asList throws UnsupportedOperationException

[转] remove on List created by Arrays.asList throws UnsupportedOperationException

 2017/8/2 12:38:59  yhz61010  程序员俱乐部  我要评论(0)
  • 摘要:原文地址:https://stackoverflow.com/a/7885607/6091500将arrayList=Arrays.asList(list);替换成arrayList=newArrayList(Arrays.asList(list));原因:参见Arrays.asList的JavaDoc。引用Returnsafixed-sizelistbackedbythespecifiedarray.
  • 标签:operation created list Opera
原文地址:https://stackoverflow.com/a/7885607/6091500


class="java">arrayList = Arrays.asList(list);

替换成
arrayList = new ArrayList(Arrays.asList(list));

原因:参见 Arrays.asList 的 JavaDoc。
引用Returns a fixed-size list backed by the specified array.
发表评论
用户名: 匿名