简体   繁体   English

Kotlin代码到Java的转换

[英]Kotlin code to java conversion

im new to kotlin and i confused what this code equivalent in Java. 我是Kotlin的新手,我对此Java中的等效代码感到困惑。 Heres the code 继承人代码

fun <T> retryCall(call: Observable<Response<T>>)

I tried convert it to java with kotlin tool and the result is this and i dont think this is the code im looking for 我试图用kotlin工具将其转换为java,结果是这个,我不认为这是我正在寻找的代码

 void retryCall(@NotNull Observable var1);

Any help is appreciated 任何帮助表示赞赏

First of all, you only put Observable which is not the full type declared in the Kotlin code. 首先,您只放置Observable ,它不是Kotlin代码中声明的完整类型。 So as a start, do this: 因此,首先,请执行以下操作:

void retryCall(@NotNull Observable<Response<T>> var1);

But now you will get a compiler error about T . 但是现在您将得到有关T的编译器错误。 So we need to be sure this is a generic method like this: 因此,我们需要确保这是像这样的通用方法:

<T> void retryCall(@NotNull Observable<Response<T>> var1);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM