Kotlin Collections Methods for RxJava2.
Please type it in your build.gradle file.
repositories {
jcenter()
}
dependencies {
compile 'moe.pine:rxkotlin-collections:0.2.10' // with RxJava
compile 'moe.pine:rxkotlin-collections:0.3.0' // with RxJava 2
}
You can use Observable / Flowable extensions like Kotlin collections as the following.
import moe.pine.rx.collections.filterIndexed
import io.reactivex.Observable
val observable: Observable<String> = Observable.fromArray("a", "b", "c")
observable.filterIndexed { i, value -> i % 2 == 0 }.subscribe { println(it) }
// => "a", "c"
In addition, this library provides an extensions of the following.
- filterIndexed
- filterIsInstance
- filterNot
- flatten
- forEachIndexed
- isNotEmpty
- mapIndexed
- none
- orEmpty
- reduceIndexed
- withIndex
- filterIndexed
- filterIsInstance
- filterNot
- flatten
- forEachIndexed
- isNotEmpty
- mapIndexed
- none
- orEmpty
- reduceIndexed
- withIndex
$ ./gradlew clean test
$ export BINTRAY_USER=username
$ export BINTRAY_API_KEY=apiKey
$ ./gradlew clean assemble bintrayUpload
MIT © Pine Mizune