集合的判空一般判定方法
ArrayList<Person> list = null; System.out.println(null == list);//return true System.out.println(list.isEmpty());// null point error
ArrayList<Person> list = new ArrayList<Person>(); System.out.println(list.isEmpty());//true System.out.println(list==null);//false
结论:判空的顺序:
if(null != list && !list.isEmpty()){ //code }