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

哈希數據存儲在哪裡

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

閱讀全文

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

熱點內容
微信二維碼變成鏈接 瀏覽:255
電腦pe安裝系統映像文件找不到 瀏覽:942
凱立德導航mips主程序 瀏覽:495
win7雙擊程序就閃退 瀏覽:105
微信上怎麼看骰子輸贏 瀏覽:665
法律文件圖片高清 瀏覽:386
word批量轉pdf注冊碼 瀏覽:339
mapreduce輸入多個文件 瀏覽:961
網路招生怎麼加學生微信 瀏覽:851
企業網站如何製作cms 瀏覽:175
文件移動到win10不見了 瀏覽:788
nsa工具使用過程 瀏覽:26
電腦如何換wifi密碼 瀏覽:162
ios11文件夾bug 瀏覽:135
c加密配置文件 瀏覽:276
pdf閱讀器程序軟體下載 瀏覽:278
直流數字電壓表程序 瀏覽:302
微信622版本 瀏覽:504
AUTOCAD文件擴展名是什麼 瀏覽:157
啥叫文件名 瀏覽:468

友情鏈接