title: Why should one use Objects.requireNonNull()?
body: <p>I have noted that many Java 8 methods in Oracle JDK use <code>Objects.requireNonNull()</code>, which internally throws <code>NullPointerException</code> if the given object (argument) is <code>null</code>.</p>
  
  <pre><code>public static &lt;T&gt; T requireNonNull(T obj) {
      if (obj == null)
          throw new NullPointerException();
      return obj;
  }
  </code></pre>
  
  <p>But <code>NullPointerException</code> will be thrown anyway if a <code>null</code> object is dereferenced. So, why should one do this extra null check and throw 
  <code>NullPointerException</code>?</p>
  
  <p>One obvious answer (or benefit) is that it makes code more readable and I agree. I'm keen to know any other reasons for using 
  <code>Objects.requireNonNull()</code> in the beginning of the method.</p>