Documentation ¶
Index ¶
- type RandomMap
- func (rmap *RandomMap) Delete(key interface{}) (result interface{}, exists bool)
- func (rmap *RandomMap) ForEach(consumer func(key interface{}, value interface{}))
- func (rmap *RandomMap) Get(key interface{}) (result interface{}, exists bool)
- func (rmap *RandomMap) Keys() (result []interface{})
- func (rmap *RandomMap) RandomEntry() (result interface{})
- func (rmap *RandomMap) RandomKey() (result interface{})
- func (rmap *RandomMap) RandomUniqueEntries(count int) (results []interface{})
- func (rmap *RandomMap) Set(key interface{}, value interface{}) (updated bool)
- func (rmap *RandomMap) Size() (result int)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RandomMap ¶
type RandomMap struct {
// contains filtered or unexported fields
}
RandomMap defines a map with extended ability to return a random entry.
func (*RandomMap) ForEach ¶
func (rmap *RandomMap) ForEach(consumer func(key interface{}, value interface{}))
ForEach iterates through the elements in the map and calls the consumer function for each element.
func (*RandomMap) Keys ¶
func (rmap *RandomMap) Keys() (result []interface{})
Keys returns the list of keys stored in the RandomMap.
func (*RandomMap) RandomEntry ¶
func (rmap *RandomMap) RandomEntry() (result interface{})
RandomEntry returns a random value from the map.
func (*RandomMap) RandomKey ¶
func (rmap *RandomMap) RandomKey() (result interface{})
RandomKey returns a random key from the map.
func (*RandomMap) RandomUniqueEntries ¶
RandomUniqueEntries returns n random and unique values from the map. When count is equal or bigger than the size of the random map, the every entry in the map is returned.
Click to show internal directories.
Click to hide internal directories.