amatkivskiy
08/03/2018, 7:51 AMcheckNotNull()
compiler still thinks that the value
can be null?
class TargetClass(private val value: String? = null) {
fun functionThatUsesValue() {
checkNotNull(value)
// Still need to add ?. to the value call
println("split: ${value?.split(" ")}")
}
}
fun main(args: Array<String>) {
val target = TargetClass()
target.functionThatUsesValue()
}
kingsley
08/03/2018, 11:24 AMval nonNull = checkNotNull(value)
// use `nonNull` here freely