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...

Markdown supported · ⌘↵ to post
No responses yet.