y
05/11/2023, 10:37 AMclass MyList<T> : List {
// ...
fun MyList<Pair<T,R>>.unzip(): Pair<MyList<T>, MyList<R>> { //implementation similar to Iterable.unzip() }
}
version 2:
class MyList<T> : List {
// ...
}
fun MyList<Pair<T,R>>.unzip(): Pair<MyList<T>, MyList<R>> { //implementation similar to Iterable.unzip() }
in version 1, Kotlin (well, IntelliJ) complains that the receiver parameter is never used in unzip()
, but it doesn't complain in version 2. is there a different way to define version 1 so that it won't complain?Sam
05/11/2023, 10:44 AMMyListOfPairs<L, R>: MyList<Pair<L, R>>
and define the member function there. But version 2 is more flexible — I’d just use that.Sam
05/11/2023, 10:45 AMSam
05/11/2023, 10:49 AMy
05/11/2023, 10:49 AM