Merge remote-tracking branch 'origin' into feat/safe-put
Some checks failed
CI / Check PR Title (pull_request) Successful in 31s
CI / Go Lint (pull_request) Successful in 52s
CI / Markdown Lint (pull_request) Successful in 34s
CI / Makefile Lint (pull_request) Successful in 50s
CI / Unit Tests (pull_request) Successful in 48s
CI / Fuzz Tests (pull_request) Failing after 41s
CI / Mutation Tests (pull_request) Successful in 1m3s
Some checks failed
CI / Check PR Title (pull_request) Successful in 31s
CI / Go Lint (pull_request) Successful in 52s
CI / Markdown Lint (pull_request) Successful in 34s
CI / Makefile Lint (pull_request) Successful in 50s
CI / Unit Tests (pull_request) Successful in 48s
CI / Fuzz Tests (pull_request) Failing after 41s
CI / Mutation Tests (pull_request) Successful in 1m3s
This commit is contained in:
@@ -8,25 +8,25 @@ import (
|
||||
)
|
||||
|
||||
func Example_basic() {
|
||||
table := cuckoo.NewTable[int, string]()
|
||||
table := cuckoo.New[int, string]()
|
||||
|
||||
if _, err := table.Put(1, "Hello, World!"); err != nil {
|
||||
fmt.Println("Put error:", err)
|
||||
}
|
||||
|
||||
if item, err := table.Get(1); err != nil {
|
||||
fmt.Println("Error:", err)
|
||||
if item, ok := table.Get(1); !ok {
|
||||
fmt.Println("Not Found 1!")
|
||||
} else {
|
||||
fmt.Println("Found 1:", item)
|
||||
}
|
||||
|
||||
if item, err := table.Get(0); err != nil {
|
||||
fmt.Println("Error:", err)
|
||||
if item, ok := table.Get(0); !ok {
|
||||
fmt.Println("Not Found 0!")
|
||||
} else {
|
||||
fmt.Println("Found 0:", item)
|
||||
}
|
||||
|
||||
// Output:
|
||||
// Found 1: Hello, World!
|
||||
// Error: key '0' not found
|
||||
// Not Found 0!
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user