Created
January 19, 2023 11:19
-
-
Save alibahaaa/df99d3d14a955a19c863e64d60cfbda4 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 { | |
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