I'm trying to excise uses of com.samskivert.util.Collections, which is
full of some weird old stuff, much of it replaced by using Guava or newer 1.5 features. Instead of using a "sorted iterator", slap the elements in a TreeSet. Insertions are O(log n), and sorting an ArrayList would be O(n log n), so it should be pretty much the same (TreeSet probably uses more memory). Comments welcome. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6098 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -33,8 +33,8 @@ import java.util.regex.Pattern;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
import com.samskivert.util.Collections;
|
||||
import com.samskivert.util.HashIntMap;
|
||||
import com.samskivert.util.ObserverList;
|
||||
import com.samskivert.util.ResultListener;
|
||||
@@ -424,12 +424,11 @@ public class ChatDirector extends BasicDirector
|
||||
return result;
|
||||
|
||||
default:
|
||||
String alternativeCommands = "";
|
||||
Iterator<String> itr = Collections.getSortedIterator(possibleCommands.keySet());
|
||||
while (itr.hasNext()) {
|
||||
alternativeCommands += " /" + itr.next();
|
||||
StringBuilder buf = new StringBuilder();
|
||||
for (String cmd : Sets.newTreeSet(possibleCommands.keySet())) {
|
||||
buf.append(" /").append(cmd);
|
||||
}
|
||||
return MessageBundle.tcompose("m.unspecific_command", alternativeCommands);
|
||||
return MessageBundle.tcompose("m.unspecific_command", buf.toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user