這是排序ArrayList的正確方法嗎? 問題是該列表未被排序。這是正確的排序方法嗎?
out = new StringTokenizer(input.toString());
n = (out.countTokens());
for (int i = 0; i < n; i++) {
String[] words = { out.nextToken().toString() };
final List<String> wordList = Arrays.asList(words);
Collections.sort(wordList);
System.out.println(wordList.toString());
}
爲什麼不把這種排序移到循環之外? – Maroun 2013-04-07 13:10:15
@Maroun Maroun By alphabyte – antoxa2584 2013-04-07 13:11:45