Source File
map.go
Belonging Package
github.com/lann/ps
package ps
import (
)
type Any interface{}
IsNil() bool
Size() int
func ( *tree) ( string, Any) Map {
:= hashKey()
return setLowLevel(, , , , )
}
func ( *tree, , uint64, string, Any) *tree {
if .IsNil() { // an empty tree is easy
:= .clone()
.count = 1
.hash =
.key =
.value =
return
}
if != .hash {
:= .clone()
:= % childCount
.children[] = (.children[], >>shiftSize, , , )
recalculateCount()
return
}
, := .children[].deleteLeftmost()
:= .clone()
for := range .children {
if == {
.children[] =
} else {
.children[] = .children[]
}
}
recalculateCount()
return , true
}
func ( *tree) () int {
:= 0
for , := range .children {
if != nilMap {
++
}
}
return
}
func ( *tree) ( string) (Any, bool) {
:= hashKey()
return lookupLowLevel(, , )
}
func ( *tree, , uint64) (Any, bool) {
if .IsNil() { // an empty tree is easy
return nil, false
}
if != .hash {
:= % childCount
return (.children[], >>shiftSize, )
}
![]() |
The pages are generated with Golds v0.3.2-preview. (GOOS=darwin GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |