Per the current guidelines, we should “always” lazily initialize member variables. However, I'm not sure if this is a good idea. I agree that we should lazily initialize final members that cannot be initialized in a constructor (quite common in Android, due to the framework not being available until a hook method like onCreate has been called), and in those cases the lazy delegate is awesome. But for cases where you can directly initialize members in a constructor (init { ... }) or even directly when declaring it, I prefer those methods.
Per the current guidelines, we should “always” lazily initialize member variables. However, I'm not sure if this is a good idea. I agree that we should lazily initialize final members that cannot be initialized in a constructor (quite common in Android, due to the framework not being available until a hook method like
onCreate
has been called), and in those cases thelazy
delegate is awesome. But for cases where you can directly initialize members in a constructor (init { ... }
) or even directly when declaring it, I prefer those methods.