I want to create an Observable that emits some elements and an Observable containing a list of objects with an Interval Observable, so that the elements from the first observable will emit with some time delay. Here is my implementation:
val just1 = ArrayList<SomeClass1>()
fill in some elements
fun populateJust1() {
just1.add(SomeClass1("23", 23))
just1.add(SomeClass1("24", 24))
just1.add(SomeClass1("25", 25))
}
populateJust1()
and zip with interval Observable
Observable.fromIterable(just1)
.zipWith(Observable.interval(2, TimeUnit.SECONDS)) { item: SomeClass1, interval: Long -> item }
.subscribe(Consumer<SomeClass1> { someClass1 -> Log.v("someClass1", someClass1.toString()) })
However, the IDE, Android Studio 3.0 underlines the red zipWith statement and says:
. zipWith (((observer: Observer) → Unit)!, ((t1: SomeClass1, t2: Long) → R)!), R ; U = Long zipWith (: ((: ) → )!, : ((t1: SomeClass1, t2: U) → R)!): ! io.reactivex.Observable zipWith (ObservableSource!, BiFunction!), R ; U = ! zipWith (: ObservableSource!, : BiFunction!): ! io.reactivex.Observable zipWith ((Mutable) Iterable!, BiFunction!), U, R zipWith (: (Mutable) Iterable!, zipper: BiFunction!): ! io.reactivex.Observable zipWith ((Mutable) Iterable!, ((t1: SomeClass1, t2: Long) → R)!), R ; U = zipWith (: (Mutable) Iterable!, zipper: ((t1: SomeClass1, t2: U) → R)!): ! io.reactivex.Observable
? Java, .