Documentation ¶
Overview ¶
Package chmap ConcurrentHashMap
Index ¶
- type ConcurrentHashMap
- func (m *ConcurrentHashMap) Contains(key string) bool
- func (m *ConcurrentHashMap) Get(key string) (interface{}, bool)
- func (m *ConcurrentHashMap) GetOrDefault(key string, defVal interface{}) interface{}
- func (m *ConcurrentHashMap) Put(key string, value interface{})
- func (m *ConcurrentHashMap) Remove(key string) (interface{}, bool)
- func (m *ConcurrentHashMap) Size() int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConcurrentHashMap ¶
type ConcurrentHashMap struct {
// contains filtered or unexported fields
}
ConcurrentHashMap thread-safe string:any map
func NewWithCap ¶
func NewWithCap(capacity int) (chm ConcurrentHashMap, err error)
NewWithCap returns ConcurrentHashMap with given capacity.
func (*ConcurrentHashMap) Contains ¶
func (m *ConcurrentHashMap) Contains(key string) bool
Contains returns if there is an entry mapped by the given key.
func (*ConcurrentHashMap) Get ¶
func (m *ConcurrentHashMap) Get(key string) (interface{}, bool)
Get returns value of the entry mapped by given key. If there is mopping by given key, it returns false.
func (*ConcurrentHashMap) GetOrDefault ¶
func (m *ConcurrentHashMap) GetOrDefault(key string, defVal interface{}) interface{}
GetOrDefault returns the value of the entry mapped by the given key. If there is mopping by the given key, it returns default value argument.
func (*ConcurrentHashMap) Put ¶
func (m *ConcurrentHashMap) Put(key string, value interface{})
Put maps the given key to the value, and saves the entry. In case of there is already an entry mapped by the given key, it updates the value of the entry.
func (*ConcurrentHashMap) Remove ¶
func (m *ConcurrentHashMap) Remove(key string) (interface{}, bool)
Remove removes the entry mapped by the given key and returns value of removed entry and true. In case of there is entry by the given key, It returns nil and false.
func (*ConcurrentHashMap) Size ¶
func (m *ConcurrentHashMap) Size() int
Size returns the count of entries in the map