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

Function ExampleSortedMapBuilder_Set

immutable_test.go:2454–2472  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2452}
2453
2454func ExampleSortedMapBuilder_Set() {
2455 b := NewSortedMapBuilder[string, any](nil)
2456 b.Set("foo", "bar")
2457 b.Set("baz", 100)
2458
2459 m := b.Map()
2460 v, ok := m.Get("foo")
2461 fmt.Println("foo", v, ok)
2462
2463 v, ok = m.Get("baz")
2464 fmt.Println("baz", v, ok)
2465
2466 v, ok = m.Get("bat") // does not exist
2467 fmt.Println("bat", v, ok)
2468 // Output:
2469 // foo bar true
2470 // baz 100 true
2471 // bat <nil> false
2472}
2473
2474func ExampleSortedMapBuilder_Delete() {
2475 b := NewSortedMapBuilder[string, any](nil)

Callers

nothing calls this directly

Calls 3

MapMethod · 0.80
SetMethod · 0.45
GetMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…