Kotlin does it right – see reference for Null Safety var a: String = "abc”; a = null // compilation error var b: String? = "abc”; b = null // ok bob?.department?.head?.name val l = b?.length ?: -1 val l = b!!.length val nullableList: List<Int?> = listOf(1, 2, null, 4) val intList: List<Int> = nullableList.filterNotNull()