mirror of
https://gitee.com/johng/gf
synced 2026-06-06 02:25:47 +08:00
23 lines
318 B
Go
23 lines
318 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"github.com/gogf/gf/v2/container/glist"
|
|
)
|
|
|
|
func main() {
|
|
l := glist.New()
|
|
// Push
|
|
l.PushBack(1)
|
|
l.PushBack(2)
|
|
e := l.PushFront(0)
|
|
// Insert
|
|
l.InsertBefore(e, -1)
|
|
l.InsertAfter(e, "a")
|
|
fmt.Println(l)
|
|
// Pop
|
|
fmt.Println(l.PopFront())
|
|
fmt.Println(l.PopBack())
|
|
fmt.Println(l)
|
|
}
|