Removes an element from the map and returns it
(key string)
| 165 | |
| 166 | // Removes an element from the map and returns it |
| 167 | func (m ConcurrentHashMap) Pop(key string) (v interface{}, exists bool) { |
| 168 | // Try to get shard. |
| 169 | shard := m.GetShard(key) |
| 170 | shard.Lock() |
| 171 | v, exists = shard.items[key] |
| 172 | delete(shard.items, key) |
| 173 | shard.Unlock() |
| 174 | return v, exists |
| 175 | } |
| 176 | |
| 177 | // Checks if map is empty. |
| 178 | func (m ConcurrentHashMap) IsEmpty() bool { |