That's generally how I use lateinit, the way you described
👍 4
🙂 1
s
Susheel
07/24/2020, 8:38 PM
Thank you. I believe it's an anti-pattern to check to see if lateinits have been initialized before using them.
➕ 1
v
vgonda
07/24/2020, 8:54 PM
It makes me think that nullable, mutable properties should be used there
💯 4
p
pollux-
07/24/2020, 10:45 PM
I had the same debate over implementing cached object as lateInt. Same can be done as nullable.
Nullable give you way to express that cache may not be there so you should use safe operator.