Use sum() instead of reduce operator

This commit is contained in:
Florian Renaud 2022-10-31 17:08:56 +01:00
parent bc3fe4e5f6
commit 7d3f6365e2
1 changed files with 1 additions and 1 deletions

View File

@ -151,6 +151,6 @@ class VoiceBroadcastEventsGroup(private val group: TimelineEventsGroup) {
}
fun getDuration(): Int {
return group.events.mapNotNull { it.root.asMessageAudioEvent()?.duration }.reduceOrNull { acc, duration -> acc + duration } ?: 0
return group.events.mapNotNull { it.root.asMessageAudioEvent()?.duration }.sum()
}
}