Documentation ¶
Overview ¶
Implements a map backed by llrb tree. Elements are ordered by key in the map.
Index ¶
- type Map
- func (m *Map) Clear()
- func (m *Map) Empty() bool
- func (m *Map) Get(key compare.Comparable) (value interface{}, found bool)
- func (m *Map) Keys() []compare.Comparable
- func (m *Map) Max() (key compare.Comparable, value interface{})
- func (m *Map) Min() (key compare.Comparable, value interface{})
- func (m *Map) Put(key compare.Comparable, value interface{})
- func (m *Map) Remove(key compare.Comparable)
- func (m *Map) Size() int
- func (m *Map) Values() []interface{}
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Map ¶
type Map struct {
// contains filtered or unexported fields
}
Map holds the elements in a llrb tree
func (*Map) Get ¶
func (m *Map) Get(key compare.Comparable) (value interface{}, found bool)
Get searches the element in the map by key and returns its value. Second return parameter is true if key was found, otherwise false. Key should adhere to the comparator's type assertion, otherwise method panics.
func (*Map) Max ¶
func (m *Map) Max() (key compare.Comparable, value interface{})
Max returns the maximum key and its value from the tree map. Returns nil, nil if map is empty.
func (*Map) Min ¶
func (m *Map) Min() (key compare.Comparable, value interface{})
Min returns the minimum key and its value from the tree map. Returns nil, nil if map is empty.
func (*Map) Put ¶
func (m *Map) Put(key compare.Comparable, value interface{})
Put inserts key-value pair into the map. Key should adhere to the comparator's type assertion, otherwise method panics.
func (*Map) Remove ¶
func (m *Map) Remove(key compare.Comparable)
Remove the element from the map by key. Key should adhere to the comparator's type assertion, otherwise method panics.