Carrascado
08/05/2020, 5:06 PMnanodeath
08/05/2020, 5:10 PMCasey Brooks
08/05/2020, 5:10 PMval
equates to final
, which would imply that property must be set on object creation. lateinit
by definition means it’s not set on object creation, but some unspecified time after that. lazy { }
properties are for immutable properties not set on object creationCarrascado
08/05/2020, 5:12 PMCarrascado
08/05/2020, 5:12 PMCasey Brooks
08/05/2020, 5:12 PMCasey Brooks
08/05/2020, 5:13 PM'lateinit
allows you to forgo the null-checks as a way of telling the compiler “don’t worry, I got this one”nanodeath
08/05/2020, 5:14 PMnanodeath
08/05/2020, 5:14 PMCasey Brooks
08/05/2020, 5:14 PM?.
or !!
on itnanodeath
08/05/2020, 5:14 PMCarrascado
08/05/2020, 5:17 PMCarrascado
08/05/2020, 5:17 PMnanodeath
08/05/2020, 5:18 PMnanodeath
08/05/2020, 5:19 PMby lazy { }
might also be more appropriate, and lets you use valsCarrascado
08/05/2020, 5:19 PMCarrascado
08/05/2020, 5:20 PMnanodeath
08/05/2020, 5:22 PMCasey Brooks
08/05/2020, 5:23 PMCarrascado
08/05/2020, 5:24 PMCarrascado
08/05/2020, 5:26 PMCarrascado
08/05/2020, 5:26 PMCarrascado
08/05/2020, 5:26 PMnanodeath
08/05/2020, 5:27 PMnanodeath
08/05/2020, 5:27 PMnanodeath
08/05/2020, 5:27 PMCarrascado
08/05/2020, 5:29 PMnanodeath
08/05/2020, 5:33 PMnanodeath
08/05/2020, 5:33 PMCarrascado
08/05/2020, 5:35 PMnanodeath
08/05/2020, 5:38 PMnanodeath
08/05/2020, 5:38 PMCasey Brooks
08/05/2020, 5:39 PMCarrascado
08/05/2020, 5:44 PMCarrascado
08/05/2020, 5:44 PMCasey Brooks
08/05/2020, 5:46 PMCarrascado
08/05/2020, 5:47 PMCarrascado
08/05/2020, 5:52 PMCarrascado
08/05/2020, 5:52 PMCarrascado
08/05/2020, 5:54 PM