Documentation ¶
Index ¶
- type Color
- type DescendingEntryIterator
- type DescendingKeyIterator
- type Entry
- type EntryAction
- type EntryIterator
- type KeyIterator
- type KeyType
- type Map
- func (m *Map) CeilingEntry(key KeyType) *Entry
- func (m *Map) CeilingKey(key KeyType) KeyType
- func (m *Map) Clear()
- func (m *Map) Contains(key KeyType) bool
- func (m *Map) DescendingIterator() *DescendingEntryIterator
- func (m *Map) DescendingKeyIterator() *DescendingKeyIterator
- func (m *Map) FirstEntry() *Entry
- func (m *Map) FirstKey() KeyType
- func (m *Map) FloorEntry(key KeyType) *Entry
- func (m *Map) FloorKey(key KeyType) KeyType
- func (m *Map) Foreach(action EntryAction)
- func (m *Map) Get(key KeyType) (interface{}, bool)
- func (m *Map) GetOrDefault(key KeyType, defaultValue interface{}) interface{}
- func (m *Map) HigherEntry(key KeyType) *Entry
- func (m *Map) HigherKey(key KeyType) KeyType
- func (m *Map) InOrderTraversal(action EntryAction)
- func (m *Map) IsEmpty() bool
- func (m *Map) Iterator() *EntryIterator
- func (m *Map) KeyIterator() *KeyIterator
- func (m *Map) Keys() []KeyType
- func (m *Map) LastEntry() *Entry
- func (m *Map) LastKey() KeyType
- func (m *Map) PostOrderTraversal(action EntryAction)
- func (m *Map) PreOrderTraversal(action EntryAction)
- func (m *Map) Put(key KeyType, value interface{}) interface{}
- func (m *Map) Remove(key KeyType) bool
- func (m *Map) Size() int
- func (m *Map) ValueIterator() *ValueIterator
- func (m *Map) Values() []interface{}
- type ValueIterator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DescendingEntryIterator ¶ added in v0.1.17
type DescendingEntryIterator struct {
EntryIterator
}
func NewKeyDescendingEntryIterator ¶ added in v0.1.17
func NewKeyDescendingEntryIterator(m *Map, first *Entry) *DescendingEntryIterator
func (*DescendingEntryIterator) Next ¶ added in v0.1.17
func (it *DescendingEntryIterator) Next() *Entry
type DescendingKeyIterator ¶ added in v0.1.17
type DescendingKeyIterator struct {
EntryIterator
}
func NewDescendingKeyIterator ¶ added in v0.1.17
func NewDescendingKeyIterator(m *Map, first *Entry) *DescendingKeyIterator
func (*DescendingKeyIterator) Next ¶ added in v0.1.17
func (it *DescendingKeyIterator) Next() KeyType
func (*DescendingKeyIterator) Remove ¶ added in v0.1.17
func (it *DescendingKeyIterator) Remove()
type EntryAction ¶ added in v0.1.17
type EntryAction func(key KeyType, val interface{})
type EntryIterator ¶ added in v0.1.17
type EntryIterator struct {
// contains filtered or unexported fields
}
func NewEntryIterator ¶ added in v0.1.17
func NewEntryIterator(m *Map, first *Entry) *EntryIterator
func (*EntryIterator) HasNext ¶ added in v0.1.17
func (it *EntryIterator) HasNext() bool
func (*EntryIterator) Next ¶ added in v0.1.17
func (it *EntryIterator) Next() *Entry
func (*EntryIterator) Remove ¶ added in v0.1.17
func (it *EntryIterator) Remove()
Removes from the underlying collection the last element returned
type KeyIterator ¶ added in v0.1.17
type KeyIterator struct {
EntryIterator
}
func NewKeyIterator ¶ added in v0.1.17
func NewKeyIterator(m *Map, first *Entry) *KeyIterator
func (*KeyIterator) Next ¶ added in v0.1.17
func (it *KeyIterator) Next() KeyType
type KeyType ¶
type KeyType collections.Comparable
type Map ¶
type Map struct {
// contains filtered or unexported fields
}
A Red-Black tree based map implementation. more details see [java.util.TreeMap](https://bit.ly/3rQWBYO)
func (*Map) CeilingEntry ¶ added in v0.1.17
Gets the entry corresponding to the specified key; returns the entry for the least key greater than the specified key if not exist.
func (*Map) CeilingKey ¶ added in v0.1.17
Gets the specified key, return the least key greater than the specified key if not exist.
func (*Map) DescendingIterator ¶ added in v0.1.17
func (m *Map) DescendingIterator() *DescendingEntryIterator
func (*Map) DescendingKeyIterator ¶ added in v0.1.17
func (m *Map) DescendingKeyIterator() *DescendingKeyIterator
func (*Map) FirstEntry ¶ added in v0.1.17
func (*Map) FloorEntry ¶ added in v0.1.17
Gets the entry corresponding to the specified key; if no such entry exists, returns the entry for the greatest key less than the specified key;
func (*Map) FloorKey ¶ added in v0.1.17
Gets the specified key, returns the greatest key less than the specified key if not exist.
func (*Map) Foreach ¶
func (m *Map) Foreach(action EntryAction)
Performs the given action for each entry in this map until all entries have been processed or the action panic
func (*Map) Get ¶
Returns the value to which the specified key is mapped, or nil if this map contains no mapping for the key.
func (*Map) GetOrDefault ¶
Returns the value to which the specified key is mapped, or `defaultValue` if this map contains no mapping for the key.
func (*Map) HigherEntry ¶ added in v0.1.17
Gets the entry for the least key greater than the specified key
func (*Map) InOrderTraversal ¶ added in v0.1.17
func (m *Map) InOrderTraversal(action EntryAction)
in-order traversal
func (*Map) Iterator ¶ added in v0.1.17
func (m *Map) Iterator() *EntryIterator
func (*Map) KeyIterator ¶ added in v0.1.17
func (m *Map) KeyIterator() *KeyIterator
func (*Map) PostOrderTraversal ¶ added in v0.1.17
func (m *Map) PostOrderTraversal(action EntryAction)
post-order traversal
func (*Map) PreOrderTraversal ¶ added in v0.1.17
func (m *Map) PreOrderTraversal(action EntryAction)
pre-order traversal
func (*Map) Put ¶
Associates the specified value with the specified key in this map. If the map previously contained a mapping for the key, the old value is replaced.
func (*Map) ValueIterator ¶ added in v0.1.17
func (m *Map) ValueIterator() *ValueIterator
type ValueIterator ¶ added in v0.1.17
type ValueIterator struct {
EntryIterator
}
func NewValueIterator ¶ added in v0.1.17
func NewValueIterator(m *Map, first *Entry) *ValueIterator
func (*ValueIterator) Next ¶ added in v0.1.17
func (it *ValueIterator) Next() interface{}