Golang container/list.List.Init() function example
package container/list
Init initializes or clears list
Golang container/list.List.Init() 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
+26.8k Golang : Convert file content into array of bytes
+8.6k Golang : Progress bar with ∎ character
+5.3k Swift : Convert string array to array example
+7.4k Golang : Word limiter example
+9k Golang : Inject/embed Javascript before sending out to browser example
+5.8k Golang : Fix opencv.LoadHaarClassifierCascade The node does not represent a user object error
+12.3k Golang : Validate email address
+5.2k Golang : Calculate half life decay example
+5.5k Golang : If else example and common mistake
+15.2k Golang : How to check if IP address is in range
+9.1k Golang : Intercept and compare HTTP response code example
+29.5k Golang : Saving(serializing) and reading file with GOB