Kotlin:具有可空 return 值的 BiFunction 无法编译
Kotlin: BiFunction with nullable return value fails to compile
这段(大大简化的)代码无法为我编译。不知道为什么。 return 类型是 Entry?
并且 null
对我来说似乎是一个有效值。
val foo = BiFunction<Int, List<Entry>, Entry?> { foo:Int, bar:List<Entry> ->
null
}
错误信息是Null can not be a value of a non-null type Entry
谁能告诉我我错过了什么?
我正在使用:
ext.kotlin_version = '1.2.10'
compile "io.reactivex.rxjava2:rxjava:2.1.8"
compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
我欢迎任何建议。新年快乐!
这段(大大简化的)代码无法为我编译。不知道为什么。 return 类型是 Entry?
并且 null
对我来说似乎是一个有效值。
val foo = BiFunction<Int, List<Entry>, Entry?> { foo:Int, bar:List<Entry> ->
null
}
错误信息是Null can not be a value of a non-null type Entry
谁能告诉我我错过了什么?
我正在使用:
ext.kotlin_version = '1.2.10'
compile "io.reactivex.rxjava2:rxjava:2.1.8"
compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
我欢迎任何建议。新年快乐!