Rather than put things in a HashSet and then use the "sorted iterator", which

really copies everything to an ArrayList and sorts it,
let's just throw the elements into a TreeSet and iterate over that.


git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@942 c613c5cb-e716-0410-b11b-feb51c14d237
This commit is contained in:
Ray Greenwell
2010-07-19 18:57:22 +00:00
parent c2c2631435
commit 2ee6ddb355
@@ -21,8 +21,7 @@
package com.threerings.stage.tools.editor; package com.threerings.stage.tools.editor;
import java.util.HashSet; import java.util.TreeSet;
import java.util.Iterator;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
@@ -40,7 +39,6 @@ import javax.swing.event.PopupMenuListener;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
import com.samskivert.util.Collections;
import com.samskivert.util.ComparableArrayList; import com.samskivert.util.ComparableArrayList;
import com.samskivert.swing.GroupLayout; import com.samskivert.swing.GroupLayout;
@@ -173,7 +171,7 @@ public class SceneInfoPanel extends JPanel
{ {
// add all possible colorization names to the list // add all possible colorization names to the list
final TileManager tilemgr = _ctx.getTileManager(); final TileManager tilemgr = _ctx.getTileManager();
final HashSet<String> set = Sets.newHashSet(); final TreeSet<String> set = Sets.newTreeSet();
StageMisoSceneModel msmodel = StageMisoSceneModel.getSceneModel( StageMisoSceneModel msmodel = StageMisoSceneModel.getSceneModel(
_scene.getSceneModel()); _scene.getSceneModel());
msmodel.visitObjects(new ObjectVisitor() { msmodel.visitObjects(new ObjectVisitor() {
@@ -203,9 +201,8 @@ public class SceneInfoPanel extends JPanel
DefaultComboBoxModel model = DefaultComboBoxModel model =
(DefaultComboBoxModel) _colorClasses.getModel(); (DefaultComboBoxModel) _colorClasses.getModel();
model.removeAllElements(); model.removeAllElements();
for (Iterator<String> itr = Collections.getSortedIterator(set); for (String zation : set) {
itr.hasNext(); ) { model.addElement(zation);
model.addElement(itr.next());
} }
if (selected != null) { if (selected != null) {
_colorClasses.setSelectedItem(selected); _colorClasses.setSelectedItem(selected);