Add exists method to map
parent
31a03ae93e
commit
229417244d
|
@ -133,13 +133,23 @@ fn (m map) get(key string, out voidptr) bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn (m map) exists(key string) bool {
|
||||||
|
for i := 0; i < m.entries.len; i++ {
|
||||||
|
entry := m.entries[i]
|
||||||
|
if entry.key == key {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
fn (m map) print() {
|
fn (m map) print() {
|
||||||
println('<<<<<<<<')
|
println('<<<<<<<<')
|
||||||
for i := 0; i < m.entries.len; i++ {
|
for i := 0; i < m.entries.len; i++ {
|
||||||
// entry := m.entries[i]
|
// entry := m.entries[i]
|
||||||
// println('$entry.key => $entry.val')
|
// println('$entry.key => $entry.val')
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
for i := 0; i < m.cap * m.element_size; i++ {
|
for i := 0; i < m.cap * m.element_size; i++ {
|
||||||
b := m.table[i]
|
b := m.table[i]
|
||||||
print('$i: ')
|
print('$i: ')
|
||||||
|
@ -169,4 +179,3 @@ fn (m map_string) str() string {
|
||||||
s += '}'
|
s += '}'
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue