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
+16.1k Golang : Generate universally unique identifier(UUID) example
+8.1k Golang : Variadic function arguments sanity check example
+11.6k Golang : Simple file scaning and remove virus example
+4.1k Javascript : Empty an array example
+7.8k Golang : Getting Echo framework StartAutoTLS to work
+16.3k Golang : convert string or integer to big.Int type
+4.7k Chrome : How to block socketloop.com links in Google SERP?
+10.6k Golang : Get local time and equivalent time in different time zone
+8.5k Golang : How to check variable or object type during runtime?
+4.5k Java : Generate multiplication table example
+9.3k Golang : How to get garbage collection data?
+8.3k Golang : Implementing class(object-oriented programming style)