mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-24 13:08:46 +00:00
Add call tab event grouping.
This commit is contained in:
committed by
Greyson Parrelli
parent
fd1ff5e438
commit
e8570c3680
@@ -0,0 +1,8 @@
|
||||
package org.signal.core.util
|
||||
|
||||
/**
|
||||
* Flattens a List of Map<K, V> into a Map<K, V> using the + operator.
|
||||
*
|
||||
* @return A Map containing all of the K, V pairings of the maps contained in the original list.
|
||||
*/
|
||||
fun <K, V> List<Map<K, V>>.flatten(): Map<K, V> = foldRight(emptyMap()) { a, b -> a + b }
|
||||
@@ -137,6 +137,11 @@ inline fun <T> Cursor.readToList(predicate: (T) -> Boolean = { true }, mapper: (
|
||||
return list
|
||||
}
|
||||
|
||||
@JvmOverloads
|
||||
inline fun <K, V> Cursor.readToMap(predicate: (Pair<K, V>) -> Boolean = { true }, mapper: (Cursor) -> Pair<K, V>): Map<K, V> {
|
||||
return readToList(predicate, mapper).associate { it }
|
||||
}
|
||||
|
||||
inline fun <T> Cursor.readToSet(predicate: (T) -> Boolean = { true }, mapper: (Cursor) -> T): Set<T> {
|
||||
val set = mutableSetOf<T>()
|
||||
use {
|
||||
|
||||
Reference in New Issue
Block a user