Kotlin lambda with explicit return type
This worked! Someone else gave me the answer in another forum, and if they respond here, I'll mark their answer correct.
fun handle(single: Single<String>): Single<Result> {
return single
.map<Result> { Single.Success() }
.onError<Result> { Single.Error() }
}
You actually cannot explicitly declare the return type in a Kotlin lambda:
One thing missing from the lambda expression syntax presented above is the ability to specify the return type of the function.
https://kotlinlang.org/docs/reference/lambdas.html#anonymous-functions