Тёмный

Singleton Design Pattern || Implementation with Eager & Lazy Loading ✌🏻 

Native Mobile Bits
Подписаться 8 тыс.
Просмотров 1 тыс.
50% 1

Опубликовано:

 

15 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 12   
@dushyantsingh5299
@dushyantsingh5299 Год назад
Very knowledgeable lecture. Thank u so much.
@NativeMobileBits
@NativeMobileBits Год назад
Thank you for your kind words ❤🙏🏻
@ashmitachauhan7
@ashmitachauhan7 Год назад
Very important concept😍❤ Thank you🙏
@NativeMobileBits
@NativeMobileBits Год назад
Most welcome 😊
@vipulkumar3329
@vipulkumar3329 Год назад
Thank you for sharing this concept video, it’s so important you made it easy to understand 😊
@NativeMobileBits
@NativeMobileBits Год назад
♥️♥️ thanks for your kind words
@rafi2713
@rafi2713 5 месяцев назад
There are two null checks inside the getInstance() method because it is possible for the instance variable to be null even after the synchronized block. This can happen if two threads enter the synchronized block at the same time. The first thread will check if the instance variable is null, and if it is, it will create a new instance of the Singleton class. However, before the first thread can assign the new instance to the instance variable, the second thread may also enter the synchronized block and check if the instance variable is null. If it is, the second thread will also create a new instance of the Singleton class. This would result in two instances of the Singleton class being created, which is not desired.
@NativeMobileBits
@NativeMobileBits 2 месяца назад
Acha 😇
@manshalkhatri9289
@manshalkhatri9289 Год назад
Does that mean that we reduce the 4 lines each time when we use a lazy block
@NativeMobileBits
@NativeMobileBits Год назад
as its singleton, this is mix of synchronization and lazy loading, I explained how its lazy loading where we make object on first call of getInstance()
@freesources6872
@freesources6872 Год назад
is that double null check important?
@NativeMobileBits
@NativeMobileBits Год назад
Yes check the full explanation in video for why
Далее
ТИПИЧНОЕ ПОВЕДЕНИЕ МАМЫ
00:21
Просмотров 1,4 млн
Singletons | What When How 🔥
7:30
Просмотров 32 тыс.
Coroutines (What, Why, history)
10:58
Просмотров 400
Build Your Own Image Loading Library (with Threads)
22:51
A Beginner's Guide to Event-Driven Architecture
37:28