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