When I am converting Java code from a library to Kotlin I see if null checks in the Java code and wonder how best to convert this.
Do I still need the if null check in Kotlin because I cant control if Java will make the object null?
Lets say I have a CameraDevice which could come back null from Java
Should I define this like this..
private lateinit var mCameraDevice: CameraDevice
and then no null check is needed or like this..
private var mCameraDevice: CameraDevice? = null
and then keep the null check
if (mCameraDevice != null) { // do something }
Nullability in Kotlin confuses me because I feel like I shouldn't have to deal with the null and should use option one, but basically every library I use is Java so I have to deal with nulls and go with option two