导航:首页 > 数据分析 > 哈希数据存储在哪里

哈希数据存储在哪里

发布时间:2023-06-08 22:52:27

『壹』 hash查找算法 数据量在10万左右 数据库中存储

可以用,但是最好加入缓存机制。

『贰』 java中hashtable怎样存储数据和读取数据

Hashtable-哈希表类

以哈希表的形式存储数据,数据的形式是键值对.
特点:
查找速度快,遍历相对慢
键值不能有空指针和重复数据

创建
Hashtable<Integer,String> ht=new
Hashtable<Integer,String>();

添值

ht.put(1,"Andy");
ht.put(2,"Bill");
ht.put(3,"Cindy");
ht.put(4,"Dell");
ht.put(5,"Felex");
ht.put(6,"Edinburg");
ht.put(7,"Green");

取值

String str=ht.get(1);
System.out.println(str);// Andy

对键进行遍历

Iterator it = ht.keySet().iterator();

while (it.hasNext()) {
Integer key = (Integer)it.next();

System.out.println(key);
}

对值进行遍历

Iterator it = ht.values().iterator();

while (it.hasNext()) {
String value =(String) it.next();

System.out.println(value);
}

取Hashtable记录数

Hashtable<Integer,String> ht=new Hashtable<Integer,String>();

ht.put(1,"Andy");
ht.put(2,"Bill");
ht.put(3,"Cindy");
ht.put(4,"Dell");
ht.put(5,"Felex");
ht.put(6,"Edinburg");
ht.put(7,"Green");

int i=ht.size();// 7

删除元素

Hashtable<Integer,String> ht=new Hashtable<Integer,String>();

ht.put(1,"Andy");
ht.put(2,"Bill");
ht.put(3,"Cindy");
ht.put(4,"Dell");
ht.put(5,"Felex");
ht.put(6,"Edinburg");
ht.put(7,"Green");

ht.remove(1);
ht.remove(2);
ht.remove(3);
ht.remove(4);

System.out.println(ht.size());// 3

Iterator it = ht.values().iterator();

while (it.hasNext()) {
// Get value
String value =(String)
it.next();
System.out.println(value);
}

阅读全文

与哈希数据存储在哪里相关的资料

热点内容
现代密码学视频 浏览:388
小米5splus微信运动 浏览:813
热血战斗小说去哪个网站 浏览:281
小孩学哪个编程语言好 浏览:279
网站参数筛选怎么做 浏览:627
幼儿编程有什么问题 浏览:693
工商银行app人工服务在哪里 浏览:19
怎么让文件中全体内容往下移 浏览:783
魔兽争霸126版本转换器 浏览:984
word2003精简版下载 浏览:703
微博跳转appstore 浏览:537
打开文件时权限a代表什么 浏览:155
昆仑通态导出数据文件名 浏览:338
手机迁移数据为什么需要重新登录 浏览:958
录入数据库的图片如何更改 浏览:132
怎样获取邮箱帐号和密码 浏览:809
怎么通过js实现回到指定页面 浏览:140
如何用网络签字 浏览:552
三星电视拆机教程 浏览:19
创维怎么连接网络 浏览:868

友情链接