for (a = 0; a < filename; a++) {
Map<Double,String> m = new HashMap<Double,String>();
String pre = "abc";
String post = ".txt";
for (int ii = 0; ii < 11; ii++) {
m.put(similarityScore[a],pre + a + post + '\n');
}
SortedSet<Double> set = new TreeSet<Double>(m.keySet());
for (Double d : set) {
System.out.println(d + " " + m.get(d));
}
}
예 출력 :값과 함께 오는 이름과 함께 값을 정렬하는 방법은 무엇입니까?
The resulting similarity score of the query how [INITIAL OUTPUT]
abc0.txt = 0.5773502691896258
abc1.txt = 0.5773502691896258
abc2.txt = 0.5773502691896258
abc3.txt = NaN
abc4.txt = 0.5773502691896258
abc5.txt = NaN
abc6.txt = NaN
abc7.txt = NaN
abc8.txt = NaN
abc9.txt = 0.5773502691896258
abc10.txt = NaN
Similarity score sorted **DESIRED** output :
0.5773502691896258 abc0.txt
0.5773502691896258 abc1.txt
0.5773502691896258 abc2.txt
0.5773502691896258 abc4.txt
0.5773502691896258 abc9.txt
NaN abc3.txt
NaN abc5.txt
NaN abc6.txt
NaN abc7.txt
NaN abc8.txt
NaN abc10.txt
가 어떻게 텍스트 파일의 유사성 점수와 병합 할 수 있을까요 심지어 ofter 분류? 다른 의미에서 정렬 후에도 각 개별 텍스트 파일의 출력 표시는 개별 점수를 따릅니다.
이는 제쳐두고 그냥,하지만 _resultArea'는'StringBuilder'입니다'가정, 그것은'_resultArea.append를 (사용하는 어리석은 someStr + someOtherStr)'. 컴파일러는'someStr'을'someOtherStr'에 추가 할 목적으로 새로운 StringBuilder를 생성합니다. 당신은'_resultArea.append (someStr) .append (someOtherStr);을하는 것이 더 낫다.'Yay Builder pattern !! :-D – corsiKa