pub fn fetchRemove(self: *Self, key: Key) ?Value
Removes a key from the map, and returns the old value. If the key was not in the map, returns null.
self: *Self
key: Key
598 599 600 601 602 603 604
pub fn fetchRemove(self: *Self, key: Key) ?Value { const index = Indexer.indexOf(key); const result: ?Value = if (self.bits.isSet(index)) self.values[index] else null; self.bits.unset(index); self.values[index] = undefined; return result; }
Removes a key from the map, and returns the old value. If the key was not in the map, returns null.