Dead Stackoverflow,帶有Hashmap打印的矩陣表
我通過Hadoop編寫一個代碼作爲分配,以便從文本文件中讀取值的讀取矩陣表。基本上它必須讀取一個角色在某個其他角色之後出現的次數。
我有那些值的已經雖然我在Hadoop的代碼,並把它們放到一個HashMap>,並將它們傳遞到一個函數調用頻率表:
public void FrequencieTable(HashMap<Character, HashMap<Character,Integer>> charFrequentie){
String theRowList = "";
String theColumnList = "";
for(Character row : charFrequentie.keySet()){
theRowList += "\n" + row;
for(Character column : charFrequentie.get(row).keySet()) {
theColumnList += column.charValue() + "\t";
theRowList += "\t" + charFrequentie.get(row).get(column);
}
System.out.println("\t" + theColomList + "\n");
System.out.println(theRowList);
}
}
只有這給了錯誤的輸出,因爲它應該只顯示像「H」一次上的行和列,並且如果不存在有任何數據的每一個字符它應該顯示0
基本上它給出了這樣的輸出:
u s a o e m g d t n j t a n g t e m a t e e a o e u s g l j k
g 1 1 2 2
d 1 1
e 1 2 2 1 1
a 2 2 3
n 2 2
o 2 1
雖然它應該是這樣的:(不重複)
u s a o e m g d t n j
g 0 0 0 0 0 0 0 1 1 2 2
d 1 1 0 0 1 0 3 0 0 0 0
沒有任何人有任何想法,我們應該做些什麼?我們完全無能爲力。
謝謝您已經
'死Stackoverflow' - RIP) – Thomas