ArrayList<?> alist=new ArrayList<>();
ArrayList<?> blist=new ArrayList<>();
alist.addAll(blist); //报错
alist=blist;//这样竟然不报错
第三行报错的提示是:The method addAll(Collection<? extends capture#1-of ?>) in the type ArrayList<capture#1-of ?> is not applicable for the arguments (ArrayList<capture#2-of ?>)
当然要报错,现在你的list泛型里面是?,还不能确定具体类型,所有还不能往你面添加东西
ArrayList<T> alist=new ArrayList<T>();
ArrayList<T> blist=new ArrayList<T>();
alist.addAll(blist);
同问 这个问题有好的解答了吗?跪求大神解答