-
-
Notifications
You must be signed in to change notification settings - Fork 54
Expand file tree
/
Copy pathmain.go
More file actions
41 lines (31 loc) · 828 Bytes
/
Copy pathmain.go
File metadata and controls
41 lines (31 loc) · 828 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package main
import (
"fmt"
"maps"
)
func main() {
clients := map[string]int{
"mario": 99,
"ruby": 89,
}
fmt.Println(`clients := map[string]int{"mario": 99, "ruby": 89}`)
// Clone
cloned := maps.Clone(clients)
fmt.Printf("\tcloned = %v, clients = %v\n", cloned, clients)
fmt.Printf("\tcloned = %p, clients = %p\n", &cloned, &clients)
// Equal
fmt.Println("\n\tmaps.Equal(cloned, clients)", maps.Equal(clients, clients))
// Copy
dest := map[string]int{"mario": 0, "other": -1}
fmt.Println("\n", `dest := map[string]int{"mario": 0, "other": -1}`)
maps.Copy(dest, clients)
fmt.Println("\tmaps.Copy(clients, dest) =", dest)
// DeleteFunc
maps.DeleteFunc(dest, func(_ string, v int) bool {
if v > 90 {
return true
}
return false
})
fmt.Println("\tmaps.DeleteFunc(dest, v > 90) =", dest)
}