This commit is contained in:
krahets
2024-04-13 21:17:44 +08:00
parent 9332a91e26
commit 6afa70e7bc
55 changed files with 334 additions and 182 deletions
+4 -3
View File
@@ -1464,7 +1464,7 @@ index = hash(key) % capacity
/* 建構子 */
ArrayHashMap *newArrayHashMap() {
ArrayHashMap *hmap = malloc(sizeof(ArrayHashMap));
for (int i = 0; i < MAX_SIZE; i++) {
for (int i=0; i < MAX_SIZE; i++) {
hmap->buckets[i] = NULL;
}
return hmap;
@@ -1646,7 +1646,8 @@ index = hash(key) % capacity
fun valueSet(): MutableList<String> {
val valueSet = mutableListOf<String>()
for (pair in buckets) {
pair?.let { valueSet.add(it._val) }
if (pair != null)
valueSet.add(pair._val)
}
return valueSet
}
@@ -1656,7 +1657,7 @@ index = hash(key) % capacity
for (kv in pairSet()) {
val key = kv.key
val _val = kv._val
println("${key} -> ${_val}")
println("$key -> $_val")
}
}
}