New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sam Adapters for RxJava 2.x #114
Conversation
Add more zip() and combineLatest() functions to ObservableKt
add more zip() and combineLatest() to FlowableKt
I will look into Travis build errors later. For now, I see we need to create SAM adapters for the following operators, for
There might be some needed for |
Not quite sure why the Kotlin compiler is not liking |
Renamed |
|
||
object Flowables { | ||
|
||
inline fun <T1,T2,R> combineLatest(source1: Flowable<T1>, source2: Flowable<T2>, crossinline combineFunction: (T1, T2) -> R) = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I know people aren't often going to be reading this file, but I feel combiner
is a nicer name than combineFunction
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay Ill change that.
|
||
inline fun <T1,T2,T3,R> combineLatest(source1: Flowable<T1>, source2: Flowable<T2>, source3: Flowable<T3>, crossinline combiner: (T1,T2, T3) -> R) = | ||
Flowable.combineLatest(source1, source2,source3, | ||
io.reactivex.functions.Function3<T1, T2, T3, R> { t1: T1, t2: T2, t3: T3 -> combiner(t1,t2, t3) })!! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any particular reason for the fully qualified Function
s?
My compiler struggled if I didn't. |
Have a look at the methods I've defined that you've copied across. |
I'll follow up this weekend on this. |
@chris-horner Couldn't figure out the |
# Conflicts: # src/main/kotlin/io/reactivex/rxkotlin/Flowables.kt # src/main/kotlin/io/reactivex/rxkotlin/Observables.kt
@@ -1,5 +1,5 @@ | |||
buildscript { | |||
ext.kotlin_version = '1.1.0' | |||
ext.kotlin_version = '1.1.2' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1.1.2-2 is the latest one
package io.reactivex.rxkotlin | ||
|
||
import io.reactivex.Flowable | ||
import io.reactivex.functions.* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
avoid wildcard imports
@@ -0,0 +1,144 @@ | |||
package io.reactivex.rxkotlin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code formatting in all file
|
||
inline fun <T1,T2,R> combineLatest(source1: Flowable<T1>, source2: Flowable<T2>, crossinline combineFunction: (T1, T2) -> R) = | ||
Flowable.combineLatest(source1, source2, | ||
BiFunction<T1, T2, R> { t1, t2 -> combineFunction(t1,t2) })!! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why !!
?
This is the SAM adapter implementation WIP for RxKotlin 2.x, initiated from the following discussions by @chris-horner:
#103
#109