title: Kotlin null from Java
body: <p>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.</p>
  
  <p>Do I still need the if null check in Kotlin because I cant control if Java will make the object null?</p>
  
  <p>Lets say I have a CameraDevice which could come back null from Java</p>
  
  <p>Should I define this like this..</p>
  
  <pre><code>private lateinit var mCameraDevice: CameraDevice
  </code></pre>
  
  <p>and then no null check is needed or like this..</p>
  
  <pre><code>private var mCameraDevice: CameraDevice? = null
  </code></pre>
  
  <p>and then keep the null check</p>
  
  <pre><code>if (mCameraDevice != null) { // do something }
  </code></pre>
  
  <p>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</p>