Golang container/list.List.MoveToBack() function example
package container/list
MoveToBack moves element e (1st parameter) to the back of the given list. If e is not an element of the list, the list is not modified.
Golang container/list.List.MoveToBack() function usage example
package main
import (
"container/list"
"fmt"
)
func main() {
alist := list.New()
alist.PushBack("a")
alist.PushBack("b")
e := alist.PushBack("c")
alist.PushBack("d")
alist.MoveToBack(e)
for e := alist.Front(); e != nil; e = e.Next() {
fmt.Println(e.Value) // print out the elements
}
}
Output :
a
b
d
c <---- moved to the back of the list
Reference :
Advertisement
Something interesting
Tutorials
+17.7k Golang : [json: cannot unmarshal object into Go value of type]
+12.3k Golang : Validate email address
+4.4k Linux/MacOSX : Search and delete files by extension
+10.9k Golang : Sieve of Eratosthenes algorithm
+19.6k Golang : Close channel after ticker stopped example
+20.9k Golang : Underscore or snake_case to camel case example
+32.4k Golang : Math pow(the power of x^y) example
+5.4k Golang : fmt.Println prints out empty data from struct
+13.8k Generate salted password with OpenSSL example
+17.2k Google Chrome : Your connection to website is encrypted with obsolete cryptography
+9k Golang : Inject/embed Javascript before sending out to browser example
+14k Golang : Google Drive API upload and rename example