...
This commit is contained in:
parent
0f08d096f6
commit
877ee12549
1 changed files with 10 additions and 0 deletions
10
src/mapx/misc.go
Normal file
10
src/mapx/misc.go
Normal file
|
@ -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
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue