Golang container/ring.Ring.Len() function example

package container/ring

Len computes the number of elements in a ring. It executes in time proportional to the number of elements.

Golang container/ring.Ring.Len() function usage example

 package main

 import (
 "container/ring"
 "fmt"
 )

 func main() {
 r := ring.New(10)

 fmt.Printf("Ring size is : %d\n", r.Len())

 }

Output :

Ring size is : 10

Reference :

http://golang.org/pkg/container/ring/#Ring.Len

Advertisement