mirror of
https://github.com/duke-git/lancet.git
synced 2025-09-26 19:41:20 +08:00
Update stream.go
This commit is contained in:
@@ -424,8 +424,8 @@ func (s Stream[T]) ToSlice() []T {
|
|||||||
func ToMap[T any, K comparable, V any](s Stream[T], mapper func(item T) (K, V)) map[K]V {
|
func ToMap[T any, K comparable, V any](s Stream[T], mapper func(item T) (K, V)) map[K]V {
|
||||||
result := map[K]V{}
|
result := map[K]V{}
|
||||||
for _, v := range s.source {
|
for _, v := range s.source {
|
||||||
k, v := mapper(v)
|
key, value := mapper(v)
|
||||||
result[k] = v
|
result[key] = value
|
||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user