title: Java/Guava: handle 'null' arguments. Which exception?
body: <p>It's confusing: We all know the words from Doug Lea: "Null sucks". He is right.</p>
  
  <p>Now I there are some approaches to throw exceptions by using googles guava. But what would be the right way now?</p>
  
  <p>1) throwing an <strong>NullPointerException</strong></p>
  
  <pre><code>private void foo(Object arg) {
    Preconditions.checkNotNull(arg, "arg 'null' not accepted");
  }
  </code></pre>
  
  <p>2) or an <strong>IllegalArgumentException</strong></p>
  
  <pre><code>private void foo(Object arg) {
    Preconditions.checkArgument(arg!=null, "arg 'null' not accepted");
  }
  </code></pre>
  
  <p>3) or a <strong>VerifyException</strong></p>
  
  <pre><code>private void foo(Object arg) {
    Verify.verify(arg!=null, "arg 'null' not accepted");
  }
  </code></pre>
  
  <p>I mean, isn't the first approach obsolete cause we don't have a NullPointer access at this time?
  And why this new third approach.</p>
  
  <p>Could someone lift the fog?</p>