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
+16.1k Golang : How to check if input from os.Args is integer?
+15.6k Golang : rune literal not terminated error
+7.3k Golang : Of hash table and hash map
+11.2k Golang : How to pipe input data to executing child process?
+22.2k Golang : Securing password with salt
+5.2k Responsive Google Adsense
+18.4k Golang : How to remove certain lines from a file
+11.8k Golang : convert(cast) float to string
+7.9k Golang : Ways to recover memory during run time.
+5.4k Golang *File points to a file or directory ?
+21.8k Golang : Convert string slice to struct and access with reflect example
+9.9k Golang : Ordinal and Ordinalize a given number to the English ordinal numeral