title: Detect null reference in an array
body: <p>I want to detect whether or not a subrange of an array contains the null reference. Somehow like this:</p>
  
  <pre><code>public static &lt;T&gt; boolean containsNull
  (T[] array, int fromInclusive, int toExclusive)
  {
      for (int i = fromInclusive; i &lt; toExclusive; ++i)
      {
          if (array[i] == null) return true;
      }
      return false;
  }
  </code></pre>
  
  <p>Is there a method like this in the Java library so I don't have to manually loop over the array? Maybe I have been spoiled by C++'s excellent support for algorithmically focused code, where I can just write:</p>
  
  <pre><code>#include &lt;algorithm&gt;
  
  bool found_null = (std::find(array + from, array + to, 0) != array + to);
  </code></pre>