Description
orderedmap is a Go package that provides a map which remembers insertion order while keeping amortized O(1) time for Set, Get, Delete and Len. Internally it combines Go's built-in map with a trimmed-down linked list. Version 3 requires Go 1.23 and offers iterators for walking the map from the front or back and over keys or values; these work with the standard slices.Collect and maps.Collect functions, so you can turn keys or values into a slice or copy the contents into a regular map. Iterators can move in both directions and return nil past either end, though changing the map during iteration may give unexpected results. You can also loop manually with Front or Back and Next. Version 2 supports Go 1.18 to 1.22 with generics, and version 1 covers Go 1.17 and earlier.…
Highlights
- Insertion-ordered map with amortized O(1) Set, Get, Delete and Len
- Iterators from front or back, over keys or values
- Works with slices.Collect and maps.Collect
- Versions for Go 1.23+, 1.18 to 1.22, and older
Ratings & Reviews
No ratings yet
Be the first to rate Orderedmap.
People also visit
Orderedmap FAQ
What does orderedmap provide?
An ordered map for Go that keeps insertion order with amortized O(1) Set, Get, Delete and Len.
Which Go version do I need?
v3 requires Go 1.23. Use v2 for Go 1.18 to 1.22, and v1 for Go 1.17 or below.
How do I iterate?
Use AllFromFront(), AllFromBack(), Keys() or Values(), or loop manually with Front() or Back() and Next().
Is it safe to modify the map while iterating?
The README warns that changing the map during iteration may produce unexpected behavior.
What are the best Orderedmap alternatives?
Popular alternatives to Orderedmap include DataViz, Go Git and OsmAPP. See all Orderedmap alternatives




