Using the Scala Option, Some, and None idiom (instead of Java null)
Briefly

A powerful Scala idiom is to use the Option class when returning a value from a function that can be null.
Here's an example of how to use the Scala Option idiom. This source code example is copied from the original version of the book, Beginning Scala: def toInt(in: String): Option[Int] = { try { Some(Integer.parseInt(in.trim)) } catch { case e: NumberFormatException => None } }
Read at Alvinalexander
[
]
[
|
]