natario1
groupBy { }
List<Sample>
class Sample(duration: Int)
List<List<Sample>>
pedro
fold
samples.fold(mutableListOf<MutableList<Sample>>()) { groups, sample -> val duration = groups.lastOrNull()?.lastOrNull()?.duration if (sample.duration == duration) { groups.last().add(sample) } else { groups.add(mutableListOf(sample)) } groups }
diesieben07
Kroppeb
A modern programming language that makes developers happier.