MCPcopy Create free account
hub / github.com/benbjohnson/immutable / ExampleList_Iterator

Function ExampleList_Iterator

immutable_test.go:564–579  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

562}
563
564func ExampleList_Iterator() {
565 l := NewList[string]()
566 l = l.Append("foo")
567 l = l.Append("bar")
568 l = l.Append("baz")
569
570 itr := l.Iterator()
571 for !itr.Done() {
572 i, v := itr.Next()
573 fmt.Println(i, v)
574 }
575 // Output:
576 // 0 foo
577 // 1 bar
578 // 2 baz
579}
580
581func ExampleList_Iterator_reverse() {
582 l := NewList[string]()

Callers

nothing calls this directly

Calls 4

AppendMethod · 0.45
IteratorMethod · 0.45
DoneMethod · 0.45
NextMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…