I think like this `saleCars.sortedWith(compareBy(n...
# getting-started
o
I think like this
saleCars.sortedWith(compareBy(nullsLast<Double>()) { it.hot_deal_likelihood })
d
Yes, but you then need
reversed()
at the end, otherwise you get ascending
o
oh
so there’s no sortedWithDescending
d
Seems not
o
you have to reverse it at the end
k
Note that you can also flip a comparator:
saleCars.sortedWith(compareBy(nullsLast<Double>()) { it.hot_deal_likelihood }.flipped())
Instead of flipping the collection at the end.
d
I also think about life in terms of car sales. 🧌
Oh sorry, I should have put that in the #Humor thread.
k
(no my bad, I didn't see anything to do with cars at first 🤦‍♂️ )
d
lol