[rules-users] Check for null entry in collection before iterating

Wolfgang Laun wolfgang.laun at gmail.com
Mon Apr 29 12:48:04 EDT 2013


I'd dearly love to hear some good argument why null in a List<Things> is
good coding
practice (note: I'm not asking for "best practice"). - Compare these two
sentences:

    He looked into her eyes....
    He looked into her eyes.

It's pretty obvious that the ellipsis indicates a planned absence of words,
whereas the
second sentence just shows a void, or no void, at its end. (Or: lover or
typo or oculist.)
What I'm trying to say is that a  null planned to show a special case is
indistinguishable
from the null that happens due to an error.

Processing "from" while covering null is just postponing the detection of
an error - if
you are with me that null shouldn't be there in the first place.

But, yes, you can test:
   list contains null
should tell you whether there is a fly in the ointment.

-W

On 29 April 2013 15:28, dcrissman <dcrissman at redhat.com> wrote:

> I ran into this situation for which there doesn't seem to be a solution
> for:
> https://issues.jboss.org/browse/DROOLS-71
>
> I am using drools v. 5.5.0.Final
>
> My preference would  be for Drools to simply skip the null value, but if
> that is not possible, is there a way to check for a null entry?
>
> How have other people worked through this issue?
>
> Thanks.
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Check-for-null-entry-in-collection-before-iterating-tp4023583.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20130429/0065a0d9/attachment.html 


More information about the rules-users mailing list