Golang container/list.List.MoveAfter() function example
package container/list
MoveAfter moves an element (1st parameter) to its new position after mark (2nd parameter) in the list. If the element or mark is not an element of the list, or e == mark, the list is not modified.
Golang container/list.List.MoveAfter() function usage example
package main
import (
"container/list"
"fmt"
)
func main() {
alist := list.New()
alist.PushBack("a")
alist.PushBack("b")
mark := alist.PushBack("c")
e := alist.PushBack("d")
alist.MoveAfter(e, mark)
for e := alist.Front(); e != nil; e = e.Next() {
fmt.Println(e.Value) // print out the elements
}
}
Output :
a
b
c
d
Reference :
Advertisement
Something interesting
Tutorials
+9.7k Golang : List available AWS regions
+11.5k Use systeminfo to find out installed Windows Hotfix(s) or updates
+14.1k Golang : Check if a file exist or not
+5.3k PHP : Hide PHP version information from curl
+10.9k Golang : Sieve of Eratosthenes algorithm
+9k Golang : How to use Gorilla webtoolkit context package properly
+12.1k Golang : Split strings into command line arguments
+14.6k Golang : Reset buffer example
+17.5k Golang : Linked list example
+8.8k Android Studio : Image button and button example
+8.5k Android Studio : Import third-party library or package into Gradle Scripts
+16k Golang : How to reverse elements order in map ?