diff --git a/AK/HashTable.h b/AK/HashTable.h index fbe47a0cf7..8ecf295819 100644 --- a/AK/HashTable.h +++ b/AK/HashTable.h @@ -205,6 +205,12 @@ public: rehash(capacity * 2); } + ErrorOr try_ensure_capacity(size_t capacity) + { + VERIFY(capacity >= size()); + return try_rehash(capacity * 2); + } + [[nodiscard]] bool contains(T const& value) const { return find(value) != end();