Golang container/list.List.PushFrontList() function example
package container/list
PushFrontList inserts a copy of an other list at the front of the given list . The lists and other may be the same.
Golang container/list.List.PushFrontList() function usage example
package main
import (
"container/list"
"fmt"
)
func main() {
alist := list.New()
alist.PushBack("a")
alist.PushBack("b")
alist.PushBack("c")
blist := list.New()
blist.PushBack("d")
blist.PushBack("e")
blist.PushBack("f")
alist.PushFrontList(blist)
for e := alist.Front(); e != nil; e = e.Next() {
fmt.Println(e.Value) // print out the elements
}
}
Output :
d
e
f
a
b
c
Reference :
Advertisement
Something interesting
Tutorials
+13.8k Generate salted password with OpenSSL example
+35.1k Golang : Upload and download file to/from AWS S3
+6.1k nginx : force all pages to be SSL
+22.4k Golang : How to read JPG(JPEG), GIF and PNG files ?
+7.2k CloudFlare : Another way to get visitor's real IP address
+12.7k Golang : Sort and reverse sort a slice of bytes
+40.5k Golang : Convert to io.ReadSeeker type
+39k Golang : How to iterate over a []string(array)
+5.4k Javascript : How to loop over and parse JSON data?
+11k How to test Facebook App on localhost ?