2023-08-28 12:06:51 +03:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2023-10-28 14:26:50 +03:00
|
|
|
"github.com/reklesio/gods/maps"
|
2023-08-28 12:06:51 +03:00
|
|
|
"fmt"
|
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
2023-10-28 14:26:50 +03:00
|
|
|
arr := maps.NewSparse[float32, string]("default", map[float32] string {
|
2023-08-28 12:06:51 +03:00
|
|
|
5: "something at 5",
|
2023-10-27 14:41:31 +03:00
|
|
|
12: "new shit 12",
|
|
|
|
50: "die 50",
|
|
|
|
})
|
|
|
|
for i:=0 ; i<=50 ; i++ {
|
|
|
|
fmt.Println(arr.Get(float32(i)))
|
|
|
|
}
|
|
|
|
fmt.Println(arr.Size())
|
2023-08-28 12:06:51 +03:00
|
|
|
|
2023-10-27 14:41:31 +03:00
|
|
|
arr.Del(5)
|
2023-08-28 12:06:51 +03:00
|
|
|
arr.Del(12)
|
2023-10-27 14:41:31 +03:00
|
|
|
arr.Del(50)
|
|
|
|
for i:=0 ; i<=50 ; i++ {
|
|
|
|
fmt.Println(arr.Get(float32(i)))
|
2023-08-28 12:06:51 +03:00
|
|
|
}
|
2023-10-27 14:41:31 +03:00
|
|
|
fmt.Println(arr.Size())
|
|
|
|
|
|
|
|
fmt.Printf("%v\n", arr)
|
|
|
|
arr.Del(12)
|
|
|
|
arr.Set(10, "at 10")
|
|
|
|
arr.Set(100, "at 100")
|
|
|
|
arr.Set(49, "at 100")
|
|
|
|
arr.Set(48.5, "at 100")
|
|
|
|
fmt.Printf("%v\n", arr)
|
2023-08-28 12:06:51 +03:00
|
|
|
}
|