Created
April 10, 2016 19:25
-
-
Save jonvuri/5e9bb28095778bf94a295a8c7561a563 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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