This commit is contained in:
wangchuxiao
2023-03-27 15:05:40 +08:00
parent a999b9d0c4
commit cfb157d2e4
5 changed files with 130 additions and 38 deletions
+1 -1
View File
@@ -175,7 +175,7 @@ func SliceToMapAny[E any, K comparable, V any](es []E, fn func(e E) (K, V)) map[
// SliceToMap slice to map
func SliceToMap[E any, K comparable](es []E, fn func(e E) K) map[K]E {
return SliceToMapOkAny[E, K, E](es, func(e E) (K, E, bool) {
return SliceToMapOkAny(es, func(e E) (K, E, bool) {
k := fn(e)
return k, e, true
})