Documentation ¶
Overview ¶
Package std is used to demonstrate data structures that are defined in the standard library.
- container/heap - container/list - container/ ring
Example (StandardLibraryList) ¶
ExampleList is the provided example from the standard library container/list package. https://pkg.go.dev/container/list
package main import ( "container/list" "fmt" ) func main() { // Create a new list and put some numbers in it. l := list.New() e4 := l.PushBack(4) e1 := l.PushFront(1) l.InsertBefore(3, e4) l.InsertAfter(2, e1) // Iterate through list and print its contents. for e := l.Front(); e != nil; e = e.Next() { fmt.Println(e.Value) } }
Output:
Click to show internal directories.
Click to hide internal directories.