mirror of
https://github.com/samber/lo.git
synced 2025-10-05 07:56:51 +08:00
feat: deprecate lo.Reverse and move it to lom.Reverse (#576)
This commit is contained in:
20
mutable/slice_example_test.go
Normal file
20
mutable/slice_example_test.go
Normal file
@@ -0,0 +1,20 @@
|
||||
package mutable
|
||||
|
||||
import "fmt"
|
||||
|
||||
func ExampleReverse() {
|
||||
list := []int{0, 1, 2, 3, 4, 5}
|
||||
|
||||
Reverse(list)
|
||||
|
||||
fmt.Printf("%v", list)
|
||||
// Output: [5 4 3 2 1 0]
|
||||
}
|
||||
|
||||
// Fill fills elements of array with `initial` value.
|
||||
// Play: https://go.dev/play/p/VwR34GzqEub
|
||||
func Fill[T any, Slice ~[]T](collection Slice, initial T) {
|
||||
for i := range collection {
|
||||
collection[i] = initial
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user