I dont think this needs a best practice point. I guess it's something that have 
been copied/pasted from a 1st oversight..
We should only fix them and they should not reappear. Else we will end up with 
a  lot of points like that...

My 2 cents

Jacques

From: "BJ Freeman" <[EMAIL PROTECTED]>
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