Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/database/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何从Kotlin使用Flowable.generate_Java_Kotlin_Rx Java2_Kotlin Interop - Fatal编程技术网

Java 如何从Kotlin使用Flowable.generate

Java 如何从Kotlin使用Flowable.generate,java,kotlin,rx-java2,kotlin-interop,Java,Kotlin,Rx Java2,Kotlin Interop,下面是Flowable.generate的一次失败存根尝试(类型注释比我通常使用的多): val xs:Flowable=Flowable.generate( java.util.concurrent.Callable{->0}, io.reactivex.functions.BiConsumer{t1,t2->} ) 我想使用的Java签名是: public static <T, S> Flowable<T> generate(Callable<S> in

下面是Flowable.generate的一次失败存根尝试(类型注释比我通常使用的多):

val xs:Flowable=Flowable.generate(
java.util.concurrent.Callable{->0},
io.reactivex.functions.BiConsumer{t1,t2->}
)
我想使用的Java签名是:

public static <T, S> Flowable<T> generate(Callable<S> initialState, final BiConsumer<S, Emitter<T>> generator)
publicstaticflowablegenerate(可调用的initialState,最终双消费者生成器)
我得到的错误是:

Error:(145, 12) None of the following functions can be called with the arguments supplied:
@CheckReturnValue @BackpressureSupport @SchedulerSupport public final fun <T : Any!, S : Any!> generate(p0: (() -> (???..???))!, p1: (((???..???), Emitter<(???..???)>!) -> Unit)!): Flowable<(???..???)>! defined in io.reactivex.Flowable
@CheckReturnValue @BackpressureSupport @SchedulerSupport public final fun <T : Any!, S : Any!> generate(p0: (() -> (???..???))!, p1: ((???, Emitter<(???..???)>) -> ???)!): Flowable<(???..???)>! defined in io.reactivex.Flowable
@CheckReturnValue @BackpressureSupport @SchedulerSupport public open fun <T : Any!, S : Any!> generate(p0: Callable<(???..???)>!, p1: BiConsumer<(???..???), Emitter<String!>!>!): Flowable<String!>! defined in io.reactivex.Flowable
@CheckReturnValue @BackpressureSupport @SchedulerSupport public open fun <T : Any!, S : Any!> generate(p0: Callable<Int!>!, p1: BiFunction<Int!, Emitter<(???..???)>!, Int!>!): Flowable<(???..???)>! defined in io.reactivex.Flowable
Error:(145,12)使用提供的参数无法调用以下函数:
@CheckReturnValue@Backpressures Support@Scheduler Support public final fun generate(p0:(()->(??…?)!,p1:(((??…?),发射器!)->单位)!:可流动!在io.reactivex.Flowable中定义
@检查返回值@BackpressureSupport@scheduler支持公共最终乐趣生成(p0:(()->(???…?)!,p1:((??,发射器)->?)!:可流动!在io.reactivex.Flowable中定义
@CheckReturnValue@BackpressuresSupport@SchedulerSupport public open fun generate(p0:Callable!、p1:BiConsumer!):可流动!在io.reactivex.Flowable中定义
@CheckReturnValue@BackpressuresSupport@SchedulerSupport public open fun generate(p0:Callable!、p1:BiFunction!):可流动!在io.reactivex.Flowable中定义

我应该向编译器提供什么?

生成()的类型应该是
双消费者的类型应该是

val xs:Flowable=Flowable.generate(
java.util.concurrent.Callable{->0},
io.reactivex.functions.BiConsumer{t1,t2->}
)

我发誓我已经三次检查了类型参数的顺序,但显然没有。
Error:(145, 12) None of the following functions can be called with the arguments supplied:
@CheckReturnValue @BackpressureSupport @SchedulerSupport public final fun <T : Any!, S : Any!> generate(p0: (() -> (???..???))!, p1: (((???..???), Emitter<(???..???)>!) -> Unit)!): Flowable<(???..???)>! defined in io.reactivex.Flowable
@CheckReturnValue @BackpressureSupport @SchedulerSupport public final fun <T : Any!, S : Any!> generate(p0: (() -> (???..???))!, p1: ((???, Emitter<(???..???)>) -> ???)!): Flowable<(???..???)>! defined in io.reactivex.Flowable
@CheckReturnValue @BackpressureSupport @SchedulerSupport public open fun <T : Any!, S : Any!> generate(p0: Callable<(???..???)>!, p1: BiConsumer<(???..???), Emitter<String!>!>!): Flowable<String!>! defined in io.reactivex.Flowable
@CheckReturnValue @BackpressureSupport @SchedulerSupport public open fun <T : Any!, S : Any!> generate(p0: Callable<Int!>!, p1: BiFunction<Int!, Emitter<(???..???)>!, Int!>!): Flowable<(???..???)>! defined in io.reactivex.Flowable
val xs: Flowable<String> = Flowable.generate<String, Int>(
        java.util.concurrent.Callable<Int> { -> 0 },
        io.reactivex.functions.BiConsumer<Int, Emitter<String>> { t1, t2 ->  }
)