for循环语句有关问题

for循环语句问题ListGAlbumProfile listnew ArrayListGAlbumProfile(1)list.add(new GAlbumProfile(

for循环语句问题

List<GAlbumProfile> list=new ArrayList<GAlbumProfile>(1);list.add(new GAlbumProfile());list.add(null);int a=list.size();for(GAlbumProfile gAlbumProfile:list){gAlbumProfile.getNickName();}


这里,a返回的是2,说明list  set(null)了以后,list的大小增加了
结果for语句报错了