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

Method indexOf

immutable.go:895–902  ·  view source on GitHub ↗

indexOf returns the entry index of the given key. Returns -1 if key not found.

(key K, h Hasher[K])

Source from the content-addressed store, hash-verified

893
894// indexOf returns the entry index of the given key. Returns -1 if key not found.
895func (n *mapArrayNode[K, V]) indexOf(key K, h Hasher[K]) int {
896 for i := range n.entries {
897 if h.Equal(n.entries[i].key, key) {
898 return i
899 }
900 }
901 return -1
902}
903
904// get returns the value for the given key.
905func (n *mapArrayNode[K, V]) get(key K, shift uint, keyHash uint32, h Hasher[K]) (value V, ok bool) {

Callers 3

getMethod · 0.95
setMethod · 0.95
deleteMethod · 0.95

Calls 2

EqualMethod · 0.65
CompareMethod · 0.65

Tested by

no test coverage detected