so i was missing something like `associateBy { }` ...
# announcements
c
so i was missing something like
associateBy { }
which creates a list for all values with the same key... came up with this (any opinions/ideas on how to even improve?):
Copy code
fun <K, V> List<V>.associateByList(transform: (V) -> K): Map<K, List<V>> {
    val map = mutableMapOf<K, MutableList<V>>()
    this.forEach { value ->
        val key = transform(value)
        if (!map.containsKey(key)) {
            map.put(key, mutableListOf())
        }
        map[key]!! += value
    }
    return map
}