MCPcopy
hub / github.com/gogf/gf / ExampleStrIntMap_Iterator

Function ExampleStrIntMap_Iterator

container/gmap/gmap_z_example_str_int_test.go:18–35  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

16)
17
18func ExampleStrIntMap_Iterator() {
19 m := gmap.NewStrIntMap()
20 for i := 0; i < 10; i++ {
21 m.Set(gconv.String(i), i*2)
22 }
23
24 var totalValue int
25 m.Iterator(func(k string, v int) bool {
26 totalValue += v
27
28 return totalValue < 50
29 })
30
31 fmt.Println("totalValue:", totalValue)
32
33 // May Output:
34 // totalValue: 52
35}
36
37func ExampleStrIntMap_Clone() {
38 m := gmap.NewStrIntMap()

Callers

nothing calls this directly

Calls 4

SetMethod · 0.95
IteratorMethod · 0.95
NewStrIntMapFunction · 0.92
StringFunction · 0.92

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…