toTwoLevelMap

fun <K1, K2, V> Map<Pair<K1, K2>, V>.toTwoLevelMap(): Map<K1, Map<K2, V>>(source)

Transforms map of pairs as a keys into two-dimensional map where the first elements in the pair are used as primary keys and second elements as secondary keys.


inline fun <K1, K2, V, M2 : MutableMap<K2, V>, M1 : MutableMap<K1, M2>> Map<Pair<K1, K2>, V>.toTwoLevelMap(topDestination: M1, bottomDestination: () -> M2): M1(source)

Transforms map of pairs as a keys into two-dimensional map where the first elements in the pair are used as primary keys and second elements as secondary keys. topDestination specifies which map should be used to store the new primary keys and bottomDestination is used to store the new secondary keys.


fun <K1, K2, V> List<Pair<Pair<K1, K2>, V>>.toTwoLevelMap(): Map<K1, Map<K2, V>>(source)

Transforms list of pairs, where the first element consists of pairs into two-dimensional map where the first elements from the inner pair are used as primary keys and second elements as secondary keys.


inline fun <K1, K2, V, M2 : MutableMap<K2, V>, M1 : MutableMap<K1, M2>> List<Pair<Pair<K1, K2>, V>>.toTwoLevelMap(topDestination: M1, bottomDestination: () -> M2): M1(source)

Transforms list of pairs, where the first element consists of pairs into two-dimensional map where the first elements from the inner pair are used as primary keys and second elements as secondary keys. topDestination specifies which map should be used to store the new primary keys and bottomDestination is used to store the new secondary keys.