I have a list of `data class A(val b: B)`, and a `...
# stdlib
m
I have a list of
data class A(val b: B)
, and a
Comparator<B>
, how can I sort the list with this comparator?
sortedWith()
won’t work because the comparator type doesn’t match.
sortedBy()
allows me to select the inner value
b
, but then doesn’t let me choose my comparator.
e
Copy code
.sortedWith(compareBy(comparator, A::b))
m
Thanks!