gf/geg/container/gring/gring.go
2019-04-03 00:03:46 +08:00

28 lines
470 B
Go

package main
import (
"fmt"
"github.com/gogf/gf/g/container/gring"
)
func main() {
r1 := gring.New(10)
for i := 0; i < 5; i++ {
r1.Set(i).Next()
}
fmt.Println("Len:", r1.Len())
fmt.Println("Cap:", r1.Cap())
fmt.Println(r1.SlicePrev())
fmt.Println(r1.SliceNext())
r2 := gring.New(10)
for i := 0; i < 10; i++ {
r2.Set(i).Next()
}
fmt.Println("Len:", r2.Len())
fmt.Println("Cap:", r2.Cap())
fmt.Println(r2.SlicePrev())
fmt.Println(r2.SliceNext())
}