我们都知道集合在遍历时删除元素要么使用迭代器,要么倒序遍历删除,可是我这使用迭代器了为啥删除依然报错呢?找到List的remove()方法,Arrays$ArrayList->AbstractList,父类方法如下public E remove(int index) {
throw new UnsupportedOperationException();
}
乖乖,父类直接抛出异常,而且子类没有重写,等等,这个ArrayList怎么这么奇怪,还有前缀?原来是一个内部类,我这List是Arrays.asList转过来的,只能new ArrayList(Collection<? extends File> c)包装下。