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

哈希數據存儲在哪裡

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

閱讀全文

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

熱點內容
微信支付resultcode 瀏覽:224
如何編程繼電器模塊 瀏覽:698
顏色配置文件和圖像 瀏覽:595
小米雲端怎麼同步數據 瀏覽:420
蘋果手機微信文件如何轉釘釘 瀏覽:310
跨境電商新政文件 瀏覽:396
什麼app能看香港房 瀏覽:590
喪屍電視劇哪個app看 瀏覽:196
電腦版上傳視頻找不到文件在哪 瀏覽:164
javastringtemplate 瀏覽:594
聯想啟天m7300能升級內存嗎 瀏覽:698
精雕怎麼打開圖片文件 瀏覽:161
ug編程鏜孔g76如何使用 瀏覽:719
7歲到18歲少兒編程學什麼 瀏覽:413
mac文件怎麼列印 瀏覽:756
農葯登記許可證查詢哪個網站 瀏覽:857
素材站用什麼網站系統 瀏覽:173
ug如何用鉸刀編程 瀏覽:647
三國志版本介紹 瀏覽:260
情侶用的定位app有哪些 瀏覽:244

友情鏈接