2014-08-29 32 views
0

我必須藉助LinkedHashMap實現一個表,它具有1000000行和450列。我已經使用嵌套的LinkedHashMap完成了這個。首先我散列到一行然後列來找到一個特定的單元格。 我的值是字符串。 主要問題是它運行速度慢,佔用太多內存。 有沒有其他辦法來解決這個問題。大數據嵌套LinkedHashMap太慢

這裏是我Implemeted一個代碼..

public LinkedHashMap<String,Row> transitionTable; 

// This class represent the one Row of Transition Table 
public class Row implements Cloneable{ 

    // This represent the tagCount of a Row 
    LinkedHashMap<String,Float> tagCount; 
     float totalOccurance=0f; 

    //Constructor 
    public Row() 
    { 
     tagCount=new LinkedHashMap<String,Float>(); 
    } 

    // Method used to do cloning of 
    public Object Clone() throws CloneNotSupportedException 
    { 
     Row row=new Row(); 
     row.tagCount = (LinkedHashMap<String, Float>)this.tagCount.clone(); 
     return row; 
    } 
} 

請幫助!

+0

你在用什麼'LinkedHashMap'?您是否還想維護廣告訂單? – Braj 2014-08-29 16:28:58

+0

在數據庫而不是內存中進行排序。 – Braj 2014-08-29 16:29:54

+0

我也試過使用HashMap,但沒有找到任何改進.......這張表在未來非常頻繁,因此將這張表保存在硬盤中並不好。 – 2014-08-29 16:37:17

回答

0

我們有一個系統,在這個系統中我們使用Radix Tree Implementation在內存中存儲了大約10000多條記錄,我們可以從中快速搜索數據。