<script type="text/javascript">
        function HashTable() {
            this._hashtable = {};
            if (typeof (_hashtable_initialized) == "undefined") {
                HashTable.prototype.Add = function(key, value) {
                    if (key in this._hashtable) {
                        return false;
                    }
                    this._hashtable[key] = value;
                    return true;
                }
                HashTable.prototype.Remove = function(key) {
                    return delete (this._hashtable[key]);
                }
                HashTable.prototype.Count = function() {
                    var i = 0;
                    for (var k in this._hashtable)
                    { i++; }
                    return i;
                }
                HashTable.prototype.Items = function(key) {
                    return this._hashtable[key];
                }
                HashTable.prototype.Clear = function() {
                    for (var k in this._hashtable)
                    { delete this._hashtable[k]; }
                    return true;
                }
                HashTable.prototype.Contains = function(key) {
                    return typeof (this._hashtable[key]) != "undefined";
                }
                _hashtable_initialized = true;
            }
        }
    </script>

相关文章:

  • 2021-09-09
  • 2021-09-16
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-11
  • 2022-12-23
猜你喜欢
  • 2021-05-24
  • 2022-12-23
  • 2022-12-23
  • 2021-09-30
  • 2022-12-23
  • 2021-09-24
相关资源
相似解决方案