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.3k Golang : How to tell if a file is compressed either gzip or zip ?
+9.4k Golang : Create unique title slugs example
+12k Golang : Find and draw contours with OpenCV example
+6.9k Nginx : Password protect a directory/folder
+13.4k Golang : Increment string example
+15.2k JavaScript/JQuery : Detect or intercept enter key pressed example
+21.1k Golang : Sort and reverse sort a slice of strings
+12.3k Golang : 2 dimensional array example
+28.8k Golang : Detect (OS) Operating System
+9.4k Facebook : Getting the friends list with PHP return JSON format
+15.6k Golang : rune literal not terminated error
+43.5k Golang : Get hardware information such as disk, memory and CPU usage