`lateinit` has `isInitialized` to check if the fi...
# announcements
k
lateinit
has
isInitialized
to check if the field has been initialized, is there something similar for
Delegates.notNull
?
t
No, there isn't. You could write your own delegate implementation (pretty simple in this case) and keep the delegate object in an additional property in addition to the one that delegates to it. Then you could check on the delegate if it's safe to access the value. Or you just use lateinit var instead.
k
thanks for the info, will probably go for a custom Delegate, since I can't use lateinit on primitive types...
b
instead of lateinit you could use
var x: Int?
which translates to Java's Integer
☝️ 1