Golang container/list.List.Len() function example
package container/list
Len returns the number of elements in a list
Golang container/list.List.Len() function usage example
package main
import (
"container/list"
"fmt"
)
func main() {
alist := list.New()
alist.PushBack("a")
alist.PushBack("b")
alist.PushBack("c")
fmt.Println(alist.Len())
alist.Init() // reset everything
fmt.Println(alist.Len())
}
Output :
3
0
Reference :
Advertisement
Something interesting
Tutorials
+14.2k Golang : Convert IP version 6 address to integer or decimal number
+19.1k Golang : Display list of time zones with GMT
+9.1k Golang : Serving HTTP and Websocket from different ports in a program example
+38.1k Golang : Read a text file and replace certain words
+11.7k Golang : Find age or leap age from date of birth example
+11k Golang : Create S3 bucket with official aws-sdk-go package
+14.4k Golang : Parsing or breaking down URL
+31.5k Golang : Example for ECDSA(Elliptic Curve Digital Signature Algorithm) package functions
+20.3k Golang : Check if os.Stdin input data is piped or from terminal
+5.9k AWS S3 : Prevent Hotlinking policy
+6.7k Golang : Experimental emojis or emoticons icons programming language