elliotchance / elliotchance/orderedmap

feature request: add .Clear method

Open
#55 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
1k
Forks
77
PR merge metrics
No merged PRs in 30d

Description

Currently, it's impossible to clear the `OrderedMap` keeping its capacity.

A simple implementation would be:
```go
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()
}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.