gods/cmd/ll/main.go

30 lines
514 B
Go
Raw Normal View History

2023-07-21 20:38:32 +03:00
package main
import (
"fmt"
2023-10-24 00:48:29 +03:00
"github.com/reklesio/gods/lists"
2023-07-21 20:38:32 +03:00
)
func main() {
2023-10-24 00:48:29 +03:00
list := lists.NewSingly[string]("zero", "one", "two", "three", "four", "five")
fmt.Println(list)
list.Push("-one", "-two")
fmt.Println(list)
2023-08-27 15:41:30 +03:00
2023-10-24 00:48:29 +03:00
list.Swap(0, 2)
fmt.Println(list)
intList := lists.NewSingly[int](100, 5, -1, 1000, 200, 1337)
fmt.Println(intList)
intList.Sort(func(vi, vj int) bool {
return vi < vj
})
fmt.Println(intList)
intList.Sort(func(vi, vj int) bool {
return vj < vi
})
fmt.Println(intList)
2023-07-21 20:38:32 +03:00
}