706.设计哈希映射
var MyHashMap = function () {
this.data = new Map()
};
/**
* @param {number} key
* @param {number} value
* @return {void}
*/
MyHashMap.prototype.put = function (key, value) {
this.data.set(key, value)
};
/**
* @param {number} key
* @return {number}
*/
MyHashMap.prototype.get = function (key) {
return this.data.has(key) ? this.data.get(key) : -1
};
/**
* @param {number} key
* @return {void}
*/
MyHashMap.prototype.remove = function (key) {
this.data.delete(key)
};
// console.log(new Map([[1,2],[3,4]]))
/**
* Your MyHashMap object will be instantiated and called as such:
* var obj = new MyHashMap()
* obj.put(key,value)
* var param_2 = obj.get(key)
* obj.remove(key)
*/