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

Function ExampleMap_Delete

immutable_test.go:1508–1522  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1506}
1507
1508func ExampleMap_Delete() {
1509 m := NewMap[string, any](nil)
1510 m = m.Set("foo", "bar")
1511 m = m.Set("baz", 100)
1512 m = m.Delete("baz")
1513
1514 v, ok := m.Get("foo")
1515 fmt.Println("foo", v, ok)
1516
1517 v, ok = m.Get("baz")
1518 fmt.Println("baz", v, ok)
1519 // Output:
1520 // foo bar true
1521 // baz <nil> false
1522}
1523
1524func ExampleMap_Iterator() {
1525 m := NewMap[string, int](nil)

Callers

nothing calls this directly

Calls 3

SetMethod · 0.45
DeleteMethod · 0.45
GetMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…