filmov
tv
Kotlin Singleton Tutorial - Companion Object, Operator Invoke

Показать описание
In this Kotlin Singleton Tutorial, we will learn how easy it is to use Singleton Pattern in Kotlin. (Compared to other languages such as Java).
Singleton is an Object Oriented Design Pattern, and it is used when we want to have only a single instance of a class, that is shared throughout the application. It is often require, when the instance is frequently needed, so instead of creating the instance again and again, we can restrict it to just a single instance that will be shared throughout the application.
Kotlin makes, singleton very easy with zero boilerplate code. We just need to use the keyword object and the Singleton class is ready. Let's find out the whole step in this video.
0:00 What is Singleton?
0:42 Singleton the Old School Way
1:47 Companion Object
4:41 Invoke Operator
5:30 Problem with the Approach
5:54 Singleton, The Kotlin Way
If you are having difficulties navigating from one lesson to another, then click on this link and it will open the complete playlist of this Kotlin Object Oriented Programming. In this playlist all lessons are already arranged in chronological order.
All the codes about this Kotlin Android Tutorial for Beginners are organized sequentially in this repository
And if you need more support, then you can join the Simplified Coding’s Quora Space to post your questions.
If you want to get in touch with me; you can find my contact details here:
Finally, If you love my content please SHARE my courses to your friends. You can share this course to your Facebook, WhatsApp etc.
For more contents related to Software Development visit my website.
You can SUPPORT me if you want
👉 PayTM (India Only): +917549161079
You can also check some of my other courses from these links
❤️❤️ Thank You All for the Love and Support ❤️❤️
#KotlinOOP
#OOPsConcept
#LearnKotlin
Singleton is an Object Oriented Design Pattern, and it is used when we want to have only a single instance of a class, that is shared throughout the application. It is often require, when the instance is frequently needed, so instead of creating the instance again and again, we can restrict it to just a single instance that will be shared throughout the application.
Kotlin makes, singleton very easy with zero boilerplate code. We just need to use the keyword object and the Singleton class is ready. Let's find out the whole step in this video.
0:00 What is Singleton?
0:42 Singleton the Old School Way
1:47 Companion Object
4:41 Invoke Operator
5:30 Problem with the Approach
5:54 Singleton, The Kotlin Way
If you are having difficulties navigating from one lesson to another, then click on this link and it will open the complete playlist of this Kotlin Object Oriented Programming. In this playlist all lessons are already arranged in chronological order.
All the codes about this Kotlin Android Tutorial for Beginners are organized sequentially in this repository
And if you need more support, then you can join the Simplified Coding’s Quora Space to post your questions.
If you want to get in touch with me; you can find my contact details here:
Finally, If you love my content please SHARE my courses to your friends. You can share this course to your Facebook, WhatsApp etc.
For more contents related to Software Development visit my website.
You can SUPPORT me if you want
👉 PayTM (India Only): +917549161079
You can also check some of my other courses from these links
❤️❤️ Thank You All for the Love and Support ❤️❤️
#KotlinOOP
#OOPsConcept
#LearnKotlin
Комментарии