Skip to content

Commit

Permalink
fix comments
Browse files Browse the repository at this point in the history
  • Loading branch information
dxyinme committed Mar 31, 2024
1 parent 0d2775e commit b431439
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions slice/map.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,7 @@ func ToMapV[Ele any, Key comparable, Val any](
elements []Ele,
fn func(element Ele) (Key, Val),
) (resultMap map[Key]Val) {
resultMap = make(map[Key]Val)
if elements == nil {
return
}
resultMap = make(map[Key]Val, len(elements))
for _, element := range elements {
k, v := fn(element)
resultMap[k] = v
Expand Down

0 comments on commit b431439

Please sign in to comment.