AK: Remove HashMap::hash()

Using `pair_int_hash()` which subsequently uses `int_hash()` means that
ordering of the input is important. Since this operates on unordered
HashMaps as well, order of the keys and values is dependent on the
internal implementation of HashTable and might differ between HashMaps
with identical contents, making this implementation of `::hash()` not
that useful.

Fortunately, it is unused, so let's remove this footgun.
This commit is contained in:
Jelle Raaijmakers
2026-01-28 13:34:48 +01:00
committed by Jelle Raaijmakers
parent 887ed85877
commit 4c58be255a
Notes: github-actions[bot] 2026-02-06 10:57:22 +00:00

View File

@@ -301,16 +301,6 @@ public:
return list;
}
[[nodiscard]] u32 hash() const
{
u32 hash = 0;
for (auto const& [key, value] : *this) {
auto entry_hash = pair_int_hash(key.hash(), value.hash());
hash = pair_int_hash(hash, entry_hash);
}
return hash;
}
template<typename NewKeyTraits = KeyTraits, typename NewValueTraits = ValueTraits, bool NewIsOrdered = IsOrdered>
ErrorOr<HashMap<K, V, NewKeyTraits, NewValueTraits, NewIsOrdered>> clone() const
{