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

View File

@@ -1605,7 +1605,8 @@ The following code implements a simple hash table. Here, we encapsulate `key` an
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
}
@@ -1615,7 +1616,7 @@ The following code implements a simple hash table. Here, we encapsulate `key` an
for (kv in pairSet()) {
val key = kv.key
val _val = kv._val
println("${key} -> ${_val}")
println("$key -> $_val")
}
}
}