摘要: 今天使用Collections.emptyList(),返回一个空的List 但是发现它不支持Add功能,调用Add会抛出unsupportedException, 在以后要返回一个空的List,并还需要后续操作时,不能使用Collections.emptyList()方法,看文档发现,List的实现类都有自己的实现,而返回的EmptyList的实现没有实现add(int index, E element方法,使用了 AbstractList.add(int index, E element){ throw new UnsupportedOperationException(); } 阅读全文
posted @ 2011-07-12 18:40 跳刀的兔子 阅读(5660) 评论(0) 推荐(0) 编辑