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
+15.3k Golang : Get all local users and print out their home directory, description and group id
+18.8k Golang : How to make function callback or pass value from function as parameter?
+4.3k Javascript : How to show different content with noscript?
+9k Golang : How to use Gorilla webtoolkit context package properly
+14.5k Golang : Overwrite previous output with count down timer
+7.1k Golang : Validate credit card example
+16.6k Golang : Delete files by extension
+8k Golang : Handle Palindrome string with case sensitivity and unicode
+7.2k Golang : Use modern ciphers only in secure connection
+10.8k Golang : Natural string sorting example
+8.6k Golang : Progress bar with ∎ character