你好。使用自动转换器将代码从 java 转换为 kotlin。有一个设计我想不通。创建对象时星号是什么意思(return Sort(*orders))?我至少需要这个设计的名称才能进一步谷歌搜索。
class Sort (vararg orders: SortOrder) {
var orders: List<SortOrder> = ArrayList()
companion object {
fun sort(vararg orders: SortOrder): Sort {
return Sort(*orders)
}
}
init {
this.orders = Arrays.asList(*orders)
}
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (other == null || javaClass != other.javaClass) return false
val sort = other as Sort?
return orders == sort!!.orders
}
