feature request: add .Clear method
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 45/100
Research direction
Locate the OrderedMap and list implementations, then inspect how the key-value storage and linked-list state are managed. Use the proposed Clear behavior as the starting point and verify that entries are removed, pointer references are released, and existing capacity is retained. Run the repository's existing tests to confirm current map operations still work.
Written by the indexing model from the issue text.
Description
Currently, it's impossible to clear the OrderedMap keeping its capacity.
A simple implementation would be:
func (l *list[K, V]) Clear() {
l.root = Element[K, V]{} // just in case K & V are pointer types
}
func (m *OrderedMap[K, V]) Clear() {
clear(m.kv)
m.ll.Clear()
}
- Dominant language
- Go
- Stars
- 1k
- Forks
- 77
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from elliotchance/orderedmap
-
Difficulty 4/5 3-5 days Newbie friendliness 20/100
elliotchance/orderedmap#60 · 2 comments ·
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
elliotchance/orderedmap#59 · 1 comment ·
-
Difficulty 1/5 Under an hour Newbie friendliness 48/100
elliotchance/orderedmap#58 · 3 comments ·
-
Difficulty 3/5 1-2 days Newbie friendliness 42/100
elliotchance/orderedmap#56 · 1 comment · 3 reactions ·
-
Difficulty 1/5 1-3 hours Newbie friendliness 35/100
elliotchance/orderedmap#42 · 1 comment ·
All issues in elliotchance/orderedmap
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 84/100
-
enhancement needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
kind/cleanup
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
kubernetes-sigs/kueue#15947 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
sympozium-ai/sympozium#627 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100