Golang container/list.List.PushBackList() function example
package container/list
PushBackList inserts a copy of an other list at the back of the given list . The lists and other may be the same.
Golang container/list.List.PushBackList() 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.PushBackList(blist)
for e := alist.Front(); e != nil; e = e.Next() {
fmt.Println(e.Value) // print out the elements
}
}
Output :
a
b
c
d
e
f
Reference :
Advertisement
Something interesting
Tutorials
+4.3k Golang : Converting individual Jawi alphabet to Rumi(Romanized) alphabet example
+7.1k Golang : Get Alexa ranking data example
+17.6k Convert JSON to CSV in Golang
+7.5k Golang : Process json data with Jason package
+9.7k Golang : Detect number of active displays and the display's resolution
+21.5k Golang : How to read float value from standard input ?
+13.1k Golang : How to get a user home directory path?
+9k Golang : automatically figure out array length(size) with three dots
+14.2k Golang : Fix image: unknown format error
+9.7k Random number generation with crypto/rand in Go
+16.5k Golang : Check if a string contains multiple sub-strings in []string?
+6.8k Golang : Find the longest line of text example