• js实现的hashtable


    AppTui.HashTable = function()
    {
        this.__construct();
    };

    AppTui.HashTable.prototype = {
        __construct: function()
        {
            this._hash = new Object();
        },

        set: function(key, value, rewrite)
        {
            if (rewrite !== false)
            {
                this._hash[key] = value;
            }
            else if (this.get(key) != null)
            {
                this._hash[key] = value;
            }
        },

        get: function(key)
        {
            if (typeof this._hash[key] != "undefined")
            {
                return this._hash[key];
            }
            else
            {
                return null;
            }
        },

        remove: function(key)
        {
            delete this._hash[key];
        }
    };

    AppTui.HashTable.getInstance = function()
    {
        if (!this.__instance__)
        {
            this.__instance__ = new AppTui.HashTable();
        };

        return this.__instance__;
    };
  • 相关阅读:
    JavaScript
    CSS
    HTML5&CSS
    I2C mux和复杂拓扑
    如何实例化I2C设备
    SMBus 协议
    I2C 协议
    I2C和SMBus简介
    ubuntu20.04系统下更新Raspberry Pi4的DTB
    通过configfs配置的Linux USB gadget
  • 原文地址:https://www.cnblogs.com/yuanxiaoping_21cn_com/p/2284001.html
Copyright © 2020-2023  润新知