Collections.emptyList()这个方法返回的list是EmptyList

这里会返回一个EmptyList类,这个类继承了AbstractList类

AbstractList类中的set,add,remove都是不能进行操作的




执行后便会报错UnsupportedOperationException
Collections.emptyList()这个方法返回的list是EmptyList
这里会返回一个EmptyList类,这个类继承了AbstractList类
AbstractList类中的set,add,remove都是不能进行操作的
执行后便会报错UnsupportedOperationException
本文标题:Collections.emptyList()返回的list不能
本文链接:https://www.haomeiwen.com/subject/vxadsqtx.html
网友评论