ExtendedMap
is a generic map implementation in Go that provides additional functionalities such as Push, Set, Pop,
Get, and Sort. It leverages Go's generics to provide a type-safe and flexible map structure.
- Push: Adds a new key-value pair to the map.
- Set: Updates the value of an existing key.
- Get: Retrieves the value of a given key.
- Pop: Removes a key-value pair from the map.
- Sort: Returns a sorted slice of key-value pairs.
Make sure to include the ExtendedMap
implementation in your project.
m := NewExtendedMap[string, int]()
m.Push("a", 10)
m.Push("b", 20)
m.Set("a", 30)
value, exists := m.Get("a")
value, exists := m.Pop("a")
sortedPairs := m.Sort()