導航:首頁 > 數據分析 > 哈希數據存儲在哪裡

哈希數據存儲在哪裡

發布時間: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);
}

閱讀全文

與哈希數據存儲在哪裡相關的資料

熱點內容
windows系統哪個文件是桌面 瀏覽:342
qq代理國際版295破解 瀏覽:81
linux怎麼抓取臨時文件 瀏覽:702
在手機上怎麼將圖片弄成文件 瀏覽:974
蘋果賬戶名字怎麼修改 瀏覽:423
奢侈品哪個網站 瀏覽:624
數據有限公司經營范圍有哪些 瀏覽:37
網路媒介主要有哪些渠道 瀏覽:751
編程後處理後怎麼輸入到機床里 瀏覽:607
手機輸入壓縮文件密碼忘了怎麼辦 瀏覽:258
u8怎麼查生產訂單未領料數據 瀏覽:973
編程貓從哪裡來 瀏覽:577
怎麼編程測數控車間隙 瀏覽:721
文件口罩有哪些圖案 瀏覽:192
手機迅雷文件怎麼轉格式 瀏覽:523
編程天天向上是計算什麼的 瀏覽:928
js整數比較大小嗎 瀏覽:852
產品畫圖工具 瀏覽:7
acfun為什麼看不到app 瀏覽:124
flash手機源文件 瀏覽:152

友情鏈接