DEV Community

Discussion on: Head First Design Pattern: 4 of 10

sanmiade profile image
Oluwasanmi Aderibigbe Author • Edited on

Oh, That's very weird. I don't know anything about Selenium. I've always used the object keyword whenever I need to use the Singleton pattern but you can try this. It should work.

fun main() {
    val signleton = ManualSignleton.getInstance()

class ManualSignleton {
    private constructor()

    companion object {
        private var INSTANCE: ManualSignleton? = null

        fun getInstance(): ManualSignleton {
            return INSTANCE ?: synchronized(this) {
                val newInstance = ManualSignleton()
                INSTANCE = newInstance
Enter fullscreen mode Exit fullscreen mode

Let me know if it does

ddaypunk profile image
Andy Delso

If and when I get back to the project, I can try it! Thanks!