List lst = new ArrayList();
do I need to check for null ? like if (lst!=null),if if I have not added values to this array list .please confirm.?
If intialize List as follows
List lst = null; or ArrayList lst =null;
In this case I need to check for null ,if I have not added values to this array list .please confirm.
If I use enhanced for loop ,od I need to check for null and size()>0 checking?
List<
String> lst = new ArrayList<String>();
if( lst !=null&&(lst.size()>0)){
for(String strParam:lst){
strParam
}
}
Do I need to use the if( lst !=null&&(lst.size()>0)) as shown above for enhanced for loop?
Please explain.
What are the good practces for arraylist and enhanced for loop together?
do I need to intialize ArrayList always ?
do I need to check for null always?
do I need to check for size() always?
Thanks