This is an excerpt from the Scala Cookbook (partially modified for the internet). This is Recipe 20.5, “Scala best practice: Eliminate null values from your code.”
Tony Hoare, inventor of the
null reference way back in 1965, refers to the creation of the
null value as his “billion dollar mistake.” In keeping with modern best practices, you want to eliminate
null values from your code.