The idea is to load resources on demand. This way everything loads faster and when needed. In the cases it's not used, it doesn't allocate additional memory.
Why do the courses at Stanford use the lazy initialisation? [duplicate]
-
11-10-2022 - |
Question
Why does the course at Stanford use the lazy initialization for all getters?
Is this correct? Does it have any real advantage?
One advantage (for me) is that the init
method can become much shorter and you need not check if a variable is allocated.
No correct solution
OTHER TIPS
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow