Kotlin: What can I do when a Java library has an overload of both primitive and boxed type?

后端 未结 2 663
暖寄归人
暖寄归人 2021-01-05 01:55

For example, FastUtil\'s IntArrayList has a push method that accepts both int (primitive) and Integer (boxed), but Kotlin

2条回答
  •  走了就别回头了
    2021-01-05 02:30

    Have you tried writing a Java class to serve as an intermediary? That is, write your own java class with the method you want Kotlin to see, then call that method from your Kotlin code.

提交回复
热议问题