kotlin这个java代码的等价物是什么(what is the equivalent of this java code to kotlin)

什么是以下java代码的等效kotlin:

F f=new F(); convert(f, HashMap.class);

这是我到目前为止所尝试的

val f = F() convert(f, HashMap<*, *>::class.java)

这是我得到的错误:

类文字的左侧只允许使用类

what is the equivalent kotlin of the following java code:

F f=new F(); convert(f, HashMap.class);

This is what i have tried so far

val f = F() convert(f, HashMap<*, *>::class.java)

This is the error i am getting:

Only classes are allowed on the left hand side of a class literal

最满意答案

我想你可以这样做:

convert(form, HashMap::class.java)

I think you could just do this:

convert(form, HashMap::class.java)kotlin这个java代码的等价物是什么(what is the equivalent of this java code to kotlin)

什么是以下java代码的等效kotlin:

F f=new F(); convert(f, HashMap.class);

这是我到目前为止所尝试的

val f = F() convert(f, HashMap<*, *>::class.java)

这是我得到的错误:

类文字的左侧只允许使用类

what is the equivalent kotlin of the following java code:

F f=new F(); convert(f, HashMap.class);

This is what i have tried so far

val f = F() convert(f, HashMap<*, *>::class.java)

This is the error i am getting:

Only classes are allowed on the left hand side of a class literal

最满意答案

我想你可以这样做:

convert(form, HashMap::class.java)

I think you could just do this:

convert(form, HashMap::class.java)