Ignore:
Timestamp:
2015-05-18T02:14:30+02:00 (5 years ago)
Author:
Don-vip
Message:

Sonar - various performance improvements

Location:
trunk/src/org/openstreetmap/josm/gui/util
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/util/AdjustmentSynchronizer.java

    r8291 r8390  
    99import java.awt.event.ItemEvent;
    1010import java.awt.event.ItemListener;
    11 import java.util.ArrayList;
    1211import java.util.HashMap;
    13 import java.util.List;
     12import java.util.HashSet;
    1413import java.util.Map;
    1514import java.util.Observable;
    1615import java.util.Observer;
     16import java.util.Set;
    1717
    1818import javax.swing.JCheckBox;
     
    2828public class AdjustmentSynchronizer implements AdjustmentListener {
    2929
    30     private final List<Adjustable> synchronizedAdjustables;
     30    private final Set<Adjustable> synchronizedAdjustables;
    3131    private final Map<Adjustable, Boolean> enabledMap;
    3232
     
    3737     */
    3838    public AdjustmentSynchronizer() {
    39         synchronizedAdjustables = new ArrayList<>();
     39        synchronizedAdjustables = new HashSet<>();
    4040        enabledMap = new HashMap<>();
    4141        observable = new Observable();
  • trunk/src/org/openstreetmap/josm/gui/util/CellEditorSupport.java

    r7005 r8390  
    33
    44import java.util.ArrayList;
    5 import java.util.LinkedList;
     5import java.util.LinkedHashSet;
    66import java.util.List;
     7import java.util.Set;
    78
    89import javax.swing.CellEditor;
     
    1718public class CellEditorSupport {
    1819    private final CellEditor editor;
    19     private final List<CellEditorListener> listeners;
     20    private final Set<CellEditorListener> listeners;
    2021
    2122    /**
     
    2526    public CellEditorSupport(CellEditor editor) {
    2627        this.editor = editor;
    27         this.listeners = new LinkedList<>();
     28        this.listeners = new LinkedHashSet<>();
    2829    }
    2930
     
    4041    public final void addCellEditorListener(CellEditorListener l) {
    4142        synchronized (this) {
    42             if (l != null && ! listeners.contains(l)) {
     43            if (l != null && !listeners.contains(l)) {
    4344                listeners.add(l);
    4445            }
     
    5253    public final void removeCellEditorListener(CellEditorListener l) {
    5354        synchronized (this) {
    54             if (l != null &&listeners.contains(l)) {
     55            if (l != null && listeners.contains(l)) {
    5556                listeners.remove(l);
    5657            }
Note: See TracChangeset for help on using the changeset viewer.