could you put this in the best coding practices
http://docs.ofbiz.org/display/OFBADMIN/Best+Practices+Guide

Adam Heath sent the following on 8/12/2008 8:04 AM:
> As I've been going thru more ofbiz code, adding generics, I've
> discovered a bunch of the following pattern:
> 
> ....
> List items = delegator.findByAnd(...)
> Iterator itemIt = UtilMisc.toIterator(items)
> if (itemIt != null && itemIt.hasNext()) {
> ....
> 
> First off, delegator.findByAnd(and findList as well) never return null.
>  Ever.  They will return an empty list if nothing is found.  It's only
> findOne(and friends) that return null.
> 
> Because items is never null, toIterator always returns an iterator.  So
> itemIt is never null.
> 
> 
> 

Reply via email to