Safeguarding Collections and Object References with Scala's Option
We often use Option to handle collections safely:
val collection = Map.empty[Int, Int]
// unsafe way that will throw an exception if key is not present
val value = collection(1)
// safe way
val valueOpt = collection.get(1) match {
case Some(val...
martianov.dev1 min read