Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
Accumulo, mail # dev - Non Short Circuit Logic


Copy link to this message
-
Re: Non Short Circuit Logic
John Vines 2012-09-12, 21:00
SystemPermission is an enum, and calling values spits back a Collection of
those enums. If we have a null in our enum, we have a MUCH larger issue at
hand.

John

On Wed, Sep 12, 2012 at 4:54 PM, David Medinets <[EMAIL PROTECTED]>wrote:

> I didn't know for sure how the for loop acts when a null is the list.
> So I wrote some code:
>
>   List<String> strings = new ArrayList<String>();
>   strings.add("a");
>   strings.add(null);
>   strings.add("b");
>   for (String s : strings) {
>     System.out.println(s);
>   }
>
> The result is:
>
> a
> null
> b
>
> Therefore, testing for null within a for loop seems like a good idea.
>