日期:2014-05-20  浏览次数:20627 次

about Set and List
Set<T> set;
List<T> list

in which case will appear

1. set != null && set.size==0
2. list!=null && list.size()==0

thx!



------解决方案--------------------
set.size 貌似这个错了
------解决方案--------------------
应该都==null,没有new 吧!!
------解决方案--------------------
Set<T> set; //set==null
set = new HashSet(); //set != null && set.size==0
List<T> list; //list==null
list = new ArrayList(); //list != null && list.size==0


------解决方案--------------------
接3L
set.add(new T()); //set != null && set.size!=0
list.add(new T()); //list!= null && list.size!=0