func FlatMap[T any, R any](collection []T, transform func(item T, index int) []R) []R
Manipulates a slice and transforms and flattens it to a slice of another type. The transform function can either return a slice or a nil, and in the nil case no value is added to the final slice.