diff --git a/src/mapx/misc.go b/src/mapx/misc.go new file mode 100644 index 0000000..2499c53 --- /dev/null +++ b/src/mapx/misc.go @@ -0,0 +1,10 @@ +package mapx + +func Reversed[K, V comparable](m map[K] V) map[V] K { + r := make(map[V] K) + for k, v := range m { + r[v] = k + } + return r +} +