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 != nullFudge
11/20/2019, 11:26 AMPaul Woitaschek
11/20/2019, 11:35 AMPaul Woitaschek
11/20/2019, 11:38 AMlateinit var variable: String
fun main() {
val initialized = ::variable.isInitialized
}yawkat
11/20/2019, 11:38 AMPaul Woitaschek
11/20/2019, 11:38 AMPaul Woitaschek
11/20/2019, 11:39 AMPaul Woitaschek
11/20/2019, 11:40 AMpublic static final void main() {
boolean initialized = variable != null;
}LeoColman
11/20/2019, 1:16 PMLeoColman
11/20/2019, 1:17 PMisInitialized everywhere, or you'll return to a Java if not null boilerplate everywhere