Fudge
11/20/2019, 11:09 AMisInitialized
? Is it just checking some flag, or is it some expensive reflective operation, maybe it allocates objects?diesieben07
11/20/2019, 11:19 AMlateinit var foo: T
becomes var foo: T? = null
and isInitialized
simply checks foo != null
Fudge
11/20/2019, 11:26 AMPaul Woitaschek
11/20/2019, 11:35 AMlateinit var variable: String
fun main() {
val initialized = ::variable.isInitialized
}
yawkat
11/20/2019, 11:38 AMPaul Woitaschek
11/20/2019, 11:38 AMpublic static final void main() {
boolean initialized = variable != null;
}
LeoColman
11/20/2019, 1:16 PMisInitialized
everywhere, or you'll return to a Java if not null
boilerplate everywhere