zain
02/15/2022, 9:53 AMprivate fun simulateFixtures(list: List<List<Team>>) = list.map { fixture ->
fixture.toList().random()
}.shuffled().chunked(2)
Sam
02/15/2022, 10:11 AMzain
02/15/2022, 10:18 AMSam
02/15/2022, 10:24 AMfoo.let {
if (somePredicate) it.doSomething() else it
}
zain
02/15/2022, 10:25 AMSam
02/15/2022, 10:27 AMlet
+ `if`/`else`else it
on the end is particularly cumbersomeJoffrey
02/15/2022, 10:39 AMList<List<Team>>
, you don't need toList()
before using random()
on an element. It's already a list, and you don't need a copy just to choose a random element out of it.Michael de Kaste
02/15/2022, 10:45 AMcondition ? onTrue : onFalse
ephemient
02/15/2022, 12:05 PM