Last active
July 19, 2022 10:04
-
-
Save thoinv/29a65d44b601c750b1923e3703ee02be to your computer and use it in GitHub Desktop.
[Singleton Kotlin] #kotlin
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
companion object { | |
private var INSTANCE: Repository? = null | |
val instance: Repository? | |
get() { | |
if (INSTANCE == null) { | |
synchronized(Repository::class.java) { | |
if (INSTANCE == null) { | |
INSTANCE = | |
Repository() | |
} | |
} | |
} | |
return INSTANCE | |
} | |
} |
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
companion object { | |
val instance: BlockManager by lazy { BlockManager().init() } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment