Documentation
¶
Index ¶
- type Iterator
- func (it *Iterator[K, V]) Get() misc.Pair[K, V]
- func (it *Iterator[K, V]) Key() K
- func (it *Iterator[K, V]) Move()
- func (it *Iterator[K, V]) Remove()
- func (it *Iterator[K, V]) SetValue(value V)
- func (it *Iterator[K, V]) Valid() bool
- func (it *Iterator[K, V]) Value() V
- func (it *Iterator[K, V]) ValueRef() *V
- type Map
- func (m Map[K, V]) Clear()
- func (m Map[K, V]) Clone() maps.Map[K, V]
- func (m Map[K, V]) Contains(key K) bool
- func (m Map[K, V]) Get(key K) V
- func (m Map[K, V]) GetRef(key K) *V
- func (m Map[K, V]) Iterator() iter.Iterator[misc.Pair[K, V]]
- func (m Map[K, V]) Map() map[K]V
- func (m Map[K, V]) MapIterator() maps.Iterator[K, V]
- func (m Map[K, V]) RefsStream2(yield func(K, *V) bool)
- func (m Map[K, V]) Remove(key K)
- func (m Map[K, V]) Set(key K, value V)
- func (m Map[K, V]) Size() int
- func (m Map[K, V]) Stream2(yield func(K, V) bool)
- func (m Map[K, V]) TryGet(key K) (V, bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Iterator ¶ added in v1.3.3
type Iterator[K comparable, V any] struct { // contains filtered or unexported fields }
Iterator is an iterator over a HashMap.
func (*Iterator[K, V]) Key ¶ added in v1.3.3
func (it *Iterator[K, V]) Key() K
Key returns the key of the current entry.
func (*Iterator[K, V]) Move ¶ added in v1.3.3
func (it *Iterator[K, V]) Move()
Move moves the iterator to the next entry.
func (*Iterator[K, V]) Remove ¶ added in v1.3.3
func (it *Iterator[K, V]) Remove()
Remove removes the current entry from the map. The iterator will point to the next entry afterward.
func (*Iterator[K, V]) SetValue ¶ added in v1.3.3
func (it *Iterator[K, V]) SetValue(value V)
SetValue sets the value of the current entry.
type Map ¶
type Map[K comparable, V any] map[K]V
Map is a hash map with builtin map as a base.
func FromMap ¶ added in v1.3.2
func FromMap[K comparable, V any](m map[K]V) Map[K, V]
FromMap creates a new Map from the specified map.
func NewFromIterable ¶ added in v1.6.1
NewFromIterable creates a Map from the specified iter.Iterable.
func NewWithCapacity ¶ added in v1.3.0
func NewWithCapacity[K comparable, V any](capacity int) Map[K, V]
NewWithCapacity creates an empty Map with the specified capacity.
func (Map[K, V]) Get ¶
func (m Map[K, V]) Get(key K) V
Get returns the value associated with the specified key. Panics if the key is not present.
func (Map[K, V]) GetRef ¶ added in v0.8.1
func (m Map[K, V]) GetRef(key K) *V
GetRef returns a reference to the value associated with the specified key. Panics if the key is not present.
func (Map[K, V]) Map ¶ added in v1.3.0
func (m Map[K, V]) Map() map[K]V
Map returns the builtin map used as a base.
func (Map[K, V]) MapIterator ¶ added in v1.5.0
MapIterator returns an iterator over the map.
func (Map[K, V]) RefsStream2 ¶ added in v1.7.0
RefsStream2 streams over the keys and references to the values in the Map.
func (Map[K, V]) Remove ¶
func (m Map[K, V]) Remove(key K)
Remove removes the entry with the specified key. Does nothing if the key is not present.
func (Map[K, V]) Set ¶
func (m Map[K, V]) Set(key K, value V)
Set sets the value associated with the specified key.