Using a kotlin library in java code

后端 未结 1 1343
别跟我提以往
别跟我提以往 2021-01-04 21:34

I have a kotlin library FlowLayout lib as aar,

and want to use it in my java code (android) but can not to resolve kotlin.Pair.

FlowLayo         


        
相关标签:
1条回答
  • 2021-01-04 21:34

    Class kotlin.Pair belongs to the standard library org.jetbrains.kotlin:kotlin-stdlib:1.0.0, so you must have this library as a dependancy.

    It is NOT recommended to use Pair in public APIs. Rather than that, create your own data class with 2 properties and give them a clearer naming than first and second.

    The purpose of Pair is to server as a temporary data carrier in any intermediate operation. If you use it in your API, you lose in clarity.

    0 讨论(0)
提交回复
热议问题