Changeset 34793 in osm for applications/editors/josm


Ignore:
Timestamp:
2018-12-28T17:40:37+01:00 (6 years ago)
Author:
gerdp
Message:

see #17040: use ArrayList instead of HashSet and create a new instance instead of using clear().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/TagBufferAction.java

    r34782 r34793  
    88import java.util.ArrayList;
    99import java.util.Collection;
    10 import java.util.HashSet;
    1110import java.util.List;
    12 import java.util.Set;
    1311
    1412import org.openstreetmap.josm.actions.JosmAction;
     
    3129    private static final String TITLE = tr("Copy tags from previous selection");
    3230    private static final TagCollection EmptyTags = new TagCollection();
    33     private final Set<OsmPrimitive> selectionBuf = new HashSet<>();
     31    private List<OsmPrimitive> selectionBuf = new ArrayList<>();
    3432    private TagCollection tagsToPaste = EmptyTags;
    3533    /**
     
    7270        if (getLayerManager().getEditDataSet() == null) {
    7371            setEnabled(false);
    74             selectionBuf.clear();
     72            selectionBuf = new ArrayList<>();
    7573            tagsToPaste = EmptyTags;
    7674        } else
     
    8482                tagsToPaste = new TagCollection(oldTags);
    8583        }
    86         selectionBuf.clear();
    87         selectionBuf.addAll(selection);
    88 
     84        selectionBuf = new ArrayList<>(selection);
    8985        setEnabled(!selection.isEmpty() && !tagsToPaste.isEmpty());
    9086    }
     
    9490     * @param selection the selection
    9591     */
    96     private static TagCollection getCommonTags(Set<OsmPrimitive> selection) {
     92    private static TagCollection getCommonTags(List<OsmPrimitive> selection) {
    9793        if (selection.isEmpty())
    9894            return EmptyTags;
Note: See TracChangeset for help on using the changeset viewer.