X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fappletgui%2FPaintRefresher.java;h=ddf590ec435573c758fd1c233dbcedb7f7a8e5c4;hb=692669611f7244598bd34df92e8a3e5cbaf9bd2e;hp=32507fe8b2098cbad8147ddd7e1f27e2b5e21d58;hpb=f4766a7bbcfae845fc95923b01fa14ff83d589ff;p=jalview.git diff --git a/src/jalview/appletgui/PaintRefresher.java b/src/jalview/appletgui/PaintRefresher.java index 32507fe..ddf590e 100755 --- a/src/jalview/appletgui/PaintRefresher.java +++ b/src/jalview/appletgui/PaintRefresher.java @@ -24,8 +24,8 @@ import jalview.datamodel.AlignmentI; import jalview.datamodel.SequenceI; import java.awt.Component; -import java.util.Enumeration; import java.util.Hashtable; +import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Vector; @@ -52,7 +52,7 @@ public class PaintRefresher { if (components == null) { - components = new Hashtable>(); + components = new Hashtable<>(); } if (components.containsKey(seqSetId)) @@ -78,13 +78,14 @@ public class PaintRefresher return; } - for (String id : components.keySet()) + Iterator it = components.keySet().iterator(); + while (it.hasNext()) { - Vector comps = components.get(id); + Vector comps = components.get(it.next()); comps.removeElement(comp); - if (comps.size() == 0) + if (comps.isEmpty()) { - components.remove(id); + it.remove(); } } } @@ -110,10 +111,10 @@ public class PaintRefresher return; } - Enumeration e = comps.elements(); - while (e.hasMoreElements()) + Iterator it = comps.iterator(); + while (it.hasNext()) { - comp = e.nextElement(); + comp = it.next(); if (comp == source) { @@ -122,7 +123,7 @@ public class PaintRefresher if (!comp.isValid()) { - comps.removeElement(comp); + it.remove(); } else if (validateSequences && comp instanceof AlignmentPanel && source instanceof AlignmentPanel) @@ -190,8 +191,8 @@ public class PaintRefresher { // TODO: the following does not trigger any recalculation of // height/etc, or maintain the dataset - List alsq; - synchronized (alsq = comp.getSequences()) + List alsq = comp.getSequences(); + synchronized (alsq) { alsq.add(i, a1[i]); }