Documentation ¶
Index ¶
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 is a key-ordered map. The zero value is an invalid map! Use one of the construction functions (e.g., New()), to create a map for a specific key type.
func New ¶
New returns an empty Map that uses the given less than function to compare keys. For example:
type Point { X, Y int } pointMap := omap.New(func(a, b interface{}) bool { α, β := a.(Point), b.(Point) if α.X != β.X { return α.X < β.X } return α.Y < β.Y })
func NewCaseFoldedKeyed ¶
func NewCaseFoldedKeyed() *Map
NewCaseFoldedKeyed returns an empty Map that accepts case-insensitive string keys.
func NewFloat64Keyed ¶
func NewFloat64Keyed() *Map
NewFloat64Keyed returns an empty Map that accepts float64 keys.
func NewStringKeyed ¶
func NewStringKeyed() *Map
NewStringKeyed returns an empty Map that accepts case-sensitive string keys.
func (*Map) Delete ¶
Delete deletes the key-value with the given key from the Map and returns true, or does nothing and returns false if there is no key-value with the given key. For example:
deleted := myMap.Delete(key).
func (*Map) Do ¶
func (m *Map) Do(function func(interface{}, interface{}))
Do calls the given function on every key-value in the Map in order.
func (*Map) Find ¶
Find returns the value and true if the key is in the Map or nil and false otherwise. For example:
value, found := myMap.Find(key).