Home | About | Sematext search-lucene.com search-hadoop.com
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB
 Search Hadoop and all its subprojects:

Switch to Plain View
Accumulo >> mail # dev >> Non Short Circuit Logic


+
David Medinets 2012-09-12, 16:29
+
John Vines 2012-09-12, 17:22
+
Jim Klucar 2012-09-12, 18:04
Copy link to this message
-
Re: Non Short Circuit Logic
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.
+
John Vines 2012-09-12, 21:00
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB