Skip to content

Instantly share code, notes, and snippets.

@alibahaaa
Created January 19, 2023 11:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alibahaaa/df99d3d14a955a19c863e64d60cfbda4 to your computer and use it in GitHub Desktop.
Save alibahaaa/df99d3d14a955a19c863e64d60cfbda4 to your computer and use it in GitHub Desktop.
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