Florian
11/23/2019, 6:53 PMlateinit
, all properties of a class need to be initialized when the object is constructed, right?Mark Murphy
11/23/2019, 7:46 PMlateinit
and by lazy {}
are ways to supply the initial value later. Technically by lazy {}
initializes the property up front, but with a property delegate, where the effective value is determined later by evaluating the lambda.Florian
11/23/2019, 9:06 PMFlorian
11/23/2019, 9:07 PMFlorian
11/23/2019, 9:07 PMMark Murphy
11/23/2019, 9:08 PMFlorian
11/23/2019, 9:11 PMvarun
11/24/2019, 2:45 AMnull
as initialized but in Kotlin even a nullable property won't by default have the value of null
.
So initializing them with null
would also count as initializing a property.Florian
11/24/2019, 9:45 AM