Skip to content

Instantly share code, notes, and snippets.

@jonvuri
Created April 10, 2016 19:25
Show Gist options
  • Save jonvuri/5e9bb28095778bf94a295a8c7561a563 to your computer and use it in GitHub Desktop.
Save jonvuri/5e9bb28095778bf94a295a8c7561a563 to your computer and use it in GitHub Desktop.
object Staticville {
// private def makeCitizen(country: Country): Citizen
private var citizen: Citizen = null
def getCitizen(implicit country: Country): Citizen = {
citizen = citizen match {
case null => {
System.out.println("Making citizen - hopefully just once")
makeCitizen(country)
}
case _ => _
}
citizen
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment