Я преобразовал несколько JAVA
классов в Kotlin
, но в Android Studio возникает проблема Type Mismatch Error
.
Я добавляю фрагменты кода вместе со снимком экрана сообщения в IDE для справки.
JAVA КОД
Disposable disposable = Observable.just(true)
.subscribeOn(Schedulers.io())
.flatMap((Function<Object, ObservableSource<?>>) o ->
Observable.zip(mModel.getSubLocalitiesFromStores(storeType, storeVerified),
mModel.getLocalitiesFromSubLocalities(),
(subLocalities, localities) -> {
mLocalities = localities;
mSubLocalities = subLocalities;
return true;
}
))
.observeOn(AndroidSchedulers.mainThread())
.subscribe(res -> {
setUpLocalitySpinner(spinnerLocalities);
setUpSubLocalitySpinner(spinnerSubLocalities);
});
compositeDisposable.add(disposable);
KOTLIN КОД
Observable.just(true)
.subscribeOn(Schedulers.io())
.flatMap({ o->
Observable.zip<ArrayList<SubLocality>, ArrayList<Locality>, Boolean>(mModel!!.getSubLocalitiesFromStores(storeType, storeVerified),
mModel!!.localitiesFromSubLocalities,
{ subLocalities, localities ->
mLocalities = localities
mSubLocalities = subLocalities
true
}
)
} as Function<Any, ObservableSource<*>>)
.observeOn(AndroidSchedulers.mainThread())
.subscribe { res ->
setUpLocalitySpinner(spinnerLocalities)
setUpSubLocalitySpinner(spinnerSubLocalities)
}
Проблема (IDE Предупреждение)