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

Function ExampleList_Iterator_reverse

immutable_test.go:581–597  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

579}
580
581func ExampleList_Iterator_reverse() {
582 l := NewList[string]()
583 l = l.Append("foo")
584 l = l.Append("bar")
585 l = l.Append("baz")
586
587 itr := l.Iterator()
588 itr.Last()
589 for !itr.Done() {
590 i, v := itr.Prev()
591 fmt.Println(i, v)
592 }
593 // Output:
594 // 2 baz
595 // 1 bar
596 // 0 foo
597}
598
599func ExampleListBuilder_Append() {
600 b := NewListBuilder[string]()

Callers

nothing calls this directly

Calls 5

AppendMethod · 0.45
IteratorMethod · 0.45
LastMethod · 0.45
DoneMethod · 0.45
PrevMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…