This (greatly simplified) code fails to compile for me. Not sure why. The return type is Entry?
and null
seems like a valid value to me.
val foo = BiFunction<Int, List<Entry>, Entry?> { foo:Int, bar:List<Entry> ->
null
}
The error message is Null can not be a value of a non-null type Entry
Can anyone tell me what I'm missing?
I am using:
ext.kotlin_version = '1.2.10'
compile "io.reactivex.rxjava2:rxjava:2.1.8"
compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
I welcome any suggestions. Happy New Year!
The apply
method in the BiFunction
class has a @NonNull
annotation on its return value (as well as on its parameters). Apparently you can't override this by providing a nullable type as the type argument.
You probably shouldn't either: RxJava 2 streams can't have null
elements in them (see here).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With