package collections

// MapSlice returns a new slice containing the results of applying the function f to each item in the original slice.
func MapSlice[T any, O any](s []T, f func(e T) O) []O {
	r := make([]O, len(s))
	for i, e := range s {
		r[i] = f(e)
	}
	return r
}
