title: Are Maybes a good pattern for scala?
body: <p>For a while I have been struggling to integrate scala with java methods that might return null.  I came up with the following utility which helps a lot: </p>
  
  <pre><code>// produce an Option, nulls become None
  object Maybe {
      def apply[T](t:T) = if (t==null) None else Some(t)
  }
  
  Maybe(javaClass.getResultCouldBeNull()).map( result =&gt; doSomeWork(result) )
  </code></pre>
  
  <p>I have a few questions about this solution:</p>
  
  <ol>
  <li>Is there a better or more standard pattern to use? </li>
  <li>Am I duplicating something that already exists?  </li>
  <li>Does this functionality have hidden gotchas?</li>
  </ol>