title: Why throw a NullPointerException when an argument is null?
body: <p>I've seen this piece of code several times on Stackoverflow:</p>
  
  <pre><code>public void doStuff(Object anObject) {  
      if (anObject == null) {  
          throw new NullPointerException("anObject can't be null");   
      }  
      //rest of the function
  }
  </code></pre>
  
  <p>This is a guard clause against <code>null</code> parameters because passing <code>null</code> to a function that requires the argument to be non null will result in a <code>NullPointerException</code>.</p>
  
  <p>I understand the importance of guard conditions to validate arguments in other cases (i.e. checking date ranges, negative monetary values, invalid string size etc.).</p>
  
  <p>However, in the case of <code>null</code> <strong>specifically</strong> isn't throwing a <code>NullPointerException</code> redundant? How does that differ from letting the Run-time throw a <code>NullPointerException</code> itself later on?</p>
  
  <p>Note: I'm asking in a language agnostic way since the pattern itself could be applied in both Java and C#.</p>