jQuery.Hashtable = function () {
|
02 |
this .items = new Array();
|
04 |
this .add = function (key, value) {
|
05 |
if (! this .containsKey(key)) {
|
06 |
this .items[key] = value;
|
10 |
throw "key '" + key + "' allready exists." |
12 |
this .get = function (key) {
|
13 |
if ( this .containsKey(key))
|
14 |
return this .items[key];
|
19 |
this .remove = function (key) {
|
20 |
if ( this .containsKey(key)) {
|
21 |
delete this .items[key];
|
25 |
throw "key '" + key + "' does not exists." |
27 |
this .containsKey = function (key) {
|
28 |
return typeof ( this .items[key]) != "undefined" ;
|
30 |
this .containsValue = function containsValue(value) {
|
31 |
for ( var item in this .items) {
|
32 |
if ( this .items[item] == value)
|
37 |
this .contains = function (keyOrValue) {
|
38 |
return this .containsKey(keyOrValue) || this .containsValue(keyOrValue);
|
40 |
this .clear = function () {
|
41 |
this .items = new Array();
|
44 |
this .size = function () {
|
45 |
return this .itemsCount;
|
47 |
this .isEmpty = function () {
|
48 |
return this .size() == 0;
|
=======================================================
var hashtable = new jQuery.Hashtable();
|
3 |
$( '#btnAdd' ).click( function () {
|
4 |
hashtable.add($( '#txtAddKey' ).val(), $( '#txtAddValue' ).val());
|
6 |
$( '#btnGet' ).click( function () {
|
7 |
alert(hashtable.get($( '#txtGetKey' ).val()))
|
分享到:
相关推荐
WinFormHashTable最简单用法,.net hashtable ,hashtable ,hashtable用法
HashTable源码
自己写的json字符串转hashtable,或者把hashtable转为json字符
记得刚毕业那会准备面试,看过不少面试题,里面有个说出HashMap和HashTable不同的题目,我那会面试的时候也遇到不少次这个问题,还隐约记得当时的回答是这样的: HashTable是比较旧的版本;HashTable是线程安全的,...
Hashtable类的操作。Hashtable是Collections命名空间提供的一个容器,用于处理和表现类似keyvalue的键值对,其中key通常可用来快速查找,同时key是区分大小写;value用于存储对应于key的值。Hashtable中keyvalue键值...
利用asp.net遍历hashtable中的值
C#之Json字符串转换Hashtable,DataTable,DataSet方法和反转换方法.
java Hashtable的泛型化 java Hashtable的泛型化 java Hashtable的泛型化
hashMap和hashTable的区别,大家可以下载学习学习。
Hashtable存储数据例子,希望大家多多指教
hashtable和hashmap的区别
C/C++语言 hashtable代码 .c文件 适用于linux ubuntu unix等平台 terminal中操作
C# .net HashTable
HashTable 常用操作
经典讲解List和ArrayList和Vector和HashTable和HashMap区别
该文档实现了Hashtable在C#中的常用的函数
// Hashtable2.cs // 给Hashtable添加元素的示例 using System; using System.Collections; public class Test { public static void Main() { Hashtable table = new Hashtable(); table.Add("Sunday", "星期...
初级程序员面试经常问道的问题,HashMap与HashTable区别,希望有帮助
hashtable购物车Session+Hashtable实现。实现的方式多种多样,