List<Integer> list = Collections.EMPTY_LIST;
用Collections.EMPTY_LIS
T声明的list不能进行add操作否则会报错: java.lang.UnsupportedOperationException
Collections.EMPTY_LIST 的实现
public static final List EMPTY_LIST = new EmptyList<>();
EmptyList是Collections的一个静态内部类,其并没有实现add、remove方法,因此使用Collections.EMPTY_LIS
T声明的list不能进行add、remove等操作。