10 lines
146 B
Go
10 lines
146 B
Go
|
package collections
|
||
|
|
||
|
func Map[T any, M any](a []T, f func(T) M) []M {
|
||
|
n := make([]M, len(a))
|
||
|
for i, e := range a {
|
||
|
n[i] = f(e)
|
||
|
}
|
||
|
return n
|
||
|
}
|