{"id":19003375,"url":"https://github.com/wertzui123/hashmap","last_synced_at":"2026-03-04T14:01:13.187Z","repository":{"id":45802732,"uuid":"480054378","full_name":"Wertzui123/HashMap","owner":"Wertzui123","description":"A generic hashmap implementation written in V that allows any kind of key-value-pairs","archived":false,"fork":false,"pushed_at":"2023-11-24T15:09:24.000Z","size":22,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-21T13:44:24.026Z","etag":null,"topics":["hashmap","v","vlang"],"latest_commit_sha":null,"homepage":"","language":"V","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Wertzui123.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-04-10T15:12:49.000Z","updated_at":"2024-11-22T15:13:58.000Z","dependencies_parsed_at":"2023-11-24T16:26:17.358Z","dependency_job_id":"5a447eb2-ede7-49ec-b5fb-ea33be80b8ec","html_url":"https://github.com/Wertzui123/HashMap","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Wertzui123/HashMap","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Wertzui123%2FHashMap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Wertzui123%2FHashMap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Wertzui123%2FHashMap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Wertzui123%2FHashMap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Wertzui123","download_url":"https://codeload.github.com/Wertzui123/HashMap/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Wertzui123%2FHashMap/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30082995,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-04T13:22:36.021Z","status":"ssl_error","status_checked_at":"2026-03-04T13:20:45.750Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hashmap","v","vlang"],"created_at":"2024-11-08T18:18:54.066Z","updated_at":"2026-03-04T14:01:13.130Z","avatar_url":"https://github.com/Wertzui123.png","language":"V","readme":"# HashMap\nThis is a hashmap/hashtable implementation written in V.\n\u003cbr\u003eSince the standard `map` type in V does not allow for arbitrary key types, you can use this library when you need keys of different types than `string`, `integer`, `float`, `rune`, `enum` or `voidptr`[^1].\n\u003cbr\u003eNote that both your key and value types must define an `equals` as well as a `hash` method.\n\n[^1]: Those types are allowed in the default V `map` datatype, see https://github.com/vlang/v/blob/a0e7a46be4d468ecf61b0e6cd7c81f11ddbd4233/vlib/v/parser/parse_type.v#L131\n\n## Example\n```v\nimport wertzui123.hashmap\n\nstruct Str {\n\tstr string\n}\n\npub fn (s1 Str) equals(s2 Str) bool {\n\treturn s1.str == s2.str\n}\n\npub fn (s Str) hash() int {\n\treturn s.str.hash()\n}\n\nfn main() {\n\tmut m := hashmap.new_hashmap[Str, Str]()!\n\tm.set(Str{'Hello'}, Str{'World'})\n\tassert m.contains_key(Str{'Hello'})\n\tassert m.contains_value(Str{'World'})\n\tassert m.get_value(Str{'Hello'})? == Str{'World'}\n\tassert m.get_key(Str{'World'})? == Str{'Hello'}\n\tm.remove(Str{'Hello'})\n\tassert m.len == 0\n}\n```\n\n## Performance\nSince this is my first attempt at writing a hashmap, the performance is probably pretty poor; in particular, removing elements is really slow.\n\u003cbr\u003eFurthermore, the array under the hoods is scaled by only one element each time it is enlarged, which is very bad if many elements are added (you can provide an `initial_capacity` when creating a hashmap though).\n\u003cbr\u003eOf course the performance also depends a lot on what hashing algorithm you use for your keys.\n\n## License\nThis library is licensed under the MIT license (see [LICENSE](LICENSE)).","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwertzui123%2Fhashmap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwertzui123%2Fhashmap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwertzui123%2Fhashmap/lists"}