title: How to handle `null` in Scala
body: <p>When Scala app interacting with Java code it sometimes need to handle <code>null</code> returned by Java method. </p>
  
  <p>Which of this 2 ways is more scala idiomatic? Which one should I use?</p>
  
  <p>1.</p>
  
  <pre><code>val a = javaClass.javaMethod
  if (a == null) 
    throw new IllegalArgumentException("Wrong param")
  processA(a)
  </code></pre>
  
  <p>2.</p>
  
  <pre><code>val a = Option(javaClass.javaMethod)
  processA(a.getOrElse(throw new IllegalArgumentException("Wrong param")))
  </code></pre>