TreeUi: used sets instead of maps where possible
authorKirill Kalishev <kirill.kalishev@jetbrains.com>
Mon, 5 Oct 2009 03:43:54 +0000 (07:43 +0400)
committerKirill Kalishev <kirill.kalishev@jetbrains.com>
Mon, 5 Oct 2009 03:43:54 +0000 (07:43 +0400)
platform/platform-api/src/com/intellij/ide/util/treeView/AbstractTreeUi.java

index 13f6ccf4d01941da6de40b28ca9d5c1d0d0a7903..2720e768d6c759380fbf60cde543908f309cdc76 100644 (file)
@@ -66,7 +66,7 @@ class AbstractTreeUi {
   private MySelectionListener mySelectionListener;
 
   private WorkerThread myWorker = null;
-  private final ArrayList<Runnable> myActiveWorkerTasks = new ArrayList<Runnable>();
+  private final Set<Runnable> myActiveWorkerTasks = new HashSet<Runnable>();
 
   private ProgressIndicator myProgress;
   private static final int WAIT_CURSOR_DELAY = 100;
@@ -77,15 +77,15 @@ class AbstractTreeUi {
   private boolean myWasEverShown;
   private boolean myUpdateIfInactive;
 
-  private final List<Object> myLoadingParents = new ArrayList<Object>();
+  private final Set<Object> myLoadingParents = new HashSet<Object>();
   private final Map<Object, List<NodeAction>> myNodeChildrenActions = new HashMap<Object, List<NodeAction>>();
 
   private long myClearOnHideDelay = -1;
   private ScheduledExecutorService ourClearanceService;
   private final Map<AbstractTreeUi, Long> ourUi2Countdown = Collections.synchronizedMap(new WeakHashMap<AbstractTreeUi, Long>());
 
-  private final List<Runnable> myDeferredSelections = new ArrayList<Runnable>();
-  private final List<Runnable> myDeferredExpansions = new ArrayList<Runnable>();
+  private final Set<Runnable> myDeferredSelections = new HashSet<Runnable>();
+  private final Set<Runnable> myDeferredExpansions = new HashSet<Runnable>();
 
   private boolean myCanProcessDeferredSelections;
 
@@ -103,8 +103,8 @@ class AbstractTreeUi {
 
   private boolean myYeildingNow;
 
-  private final List<DefaultMutableTreeNode> myPendingNodeActions = new ArrayList<DefaultMutableTreeNode>();
-  private final List<Runnable> myYeildingDoneRunnables = new ArrayList<Runnable>();
+  private final Set<DefaultMutableTreeNode> myPendingNodeActions = new HashSet<DefaultMutableTreeNode>();
+  private final Set<Runnable> myYeildingDoneRunnables = new HashSet<Runnable>();
 
   private final Alarm myBusyAlarm = new Alarm();
   private final Runnable myWaiterForReady = new Runnable() {
@@ -605,7 +605,7 @@ class AbstractTreeUi {
     processDeferredActions(myDeferredExpansions);
   }
 
-  private void processDeferredActions(List<Runnable> actions) {
+  private void processDeferredActions(Set<Runnable> actions) {
     final Runnable[] runnables = actions.toArray(new Runnable[actions.size()]);
     actions.clear();
     for (Runnable runnable : runnables) {