WildRhum
07/31/2018, 11:48 AMdiesieben07
07/31/2018, 11:51 AMlist.sortedWith(compareBy({ it.firstProperty }, { it.secondProperty }))
nikolay
07/31/2018, 11:55 AMcompareBy {
//...
}.thenBy() {
//...
}
diesieben07
07/31/2018, 11:57 AMWildRhum
07/31/2018, 12:04 PMdiesieben07
07/31/2018, 12:05 PMWildRhum
07/31/2018, 12:08 PMdiesieben07
07/31/2018, 12:16 PMcompareByDecending
with that signature.compareBy(...).reversed()
.val comparator = compareBy<Card>({ it.attack - ennemyCard.defense }, { it.abilities.contains("Divine") })
return myCards.maxWith(comparator) ?: TODO("default value if list is empty")
WildRhum
07/31/2018, 12:19 PMcompareBy
, so I though compareByDecending
would work 😞diesieben07
07/31/2018, 12:24 PMfalse
will come before true
WildRhum
07/31/2018, 12:25 PM{ it.abilities.contains("Divine") }
diesieben07
07/31/2018, 12:26 PMin
operator hereWildRhum
07/31/2018, 12:28 PM