-
-
Save ArvinRokni/d19635574bd3620b547669d4472d376d to your computer and use it in GitHub Desktop.
This file contains 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
class Singleton private constructor(){ | |
companion object { | |
private var INSTANCE: Singleton ? = null | |
fun getInstance(): Singleton { | |
synchronized(this) { | |
if(INSTANCE == null){ | |
INSTANCE = Singleton() | |
} | |
return INSTANCE!! | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment