Changeset 9999 in josm for trunk


Ignore:
Timestamp:
2016-03-15T09:15:57+01:00 (9 years ago)
Author:
Don-vip
Message:

sonar - do not copy collection contents from one to another with a loop

Location:
trunk/src/org/openstreetmap/josm
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/OrthogonalizeAction.java

    r9948 r9999  
    305305        final Set<Node> allNodes = new HashSet<>();
    306306        for (WayData w : wayDataList) {
    307             for (Node n : w.wayNodes) {
    308                 allNodes.add(n);
    309             }
     307            allNodes.addAll(w.wayNodes);
    310308        }
    311309
  • trunk/src/org/openstreetmap/josm/actions/SelectNonBranchingWaySequences.java

    r9062 r9999  
    147147
    148148        boolean selectionChanged = false;
    149         Collection<OsmPrimitive> selection = new LinkedList<>();
    150         for (OsmPrimitive primitive : currentSelection) {
    151             selection.add(primitive);
    152         }
     149        Collection<OsmPrimitive> selection = new LinkedList<>(currentSelection);
    153150
    154151        do {
  • trunk/src/org/openstreetmap/josm/actions/SplitWayAction.java

    r9968 r9999  
    586586        newWays.remove(wayToKeep);
    587587
     588        newSelection.addAll(newWays);
    588589        for (Way wayToAdd : newWays) {
    589590            commandList.add(new AddCommand(layer, wayToAdd));
    590             newSelection.add(wayToAdd);
    591591        }
    592592
  • trunk/src/org/openstreetmap/josm/data/validation/tests/OverlappingWays.java

    r8510 r9999  
    148148                    seenWays.put(currentWays, duplicated);
    149149                } else { /* way seen, mark highlight layer only */
    150                     for (WaySegment ws : duplicated) {
    151                         highlight.add(ws);
    152                     }
     150                    highlight.addAll(duplicated);
    153151                }
    154152            }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/ParentRelationLoadingTask.java

    r9078 r9999  
    1212
    1313import org.openstreetmap.josm.Main;
    14 import org.openstreetmap.josm.data.DataSource;
    1514import org.openstreetmap.josm.data.osm.DataSet;
    1615import org.openstreetmap.josm.data.osm.DataSetMerger;
     
    165164
    166165                // copy the merged layer's data source info
    167                 for (DataSource src : referrers.dataSources) {
    168                     getLayer().data.dataSources.add(src);
    169                 }
     166                getLayer().data.dataSources.addAll(referrers.dataSources);
    170167                // FIXME: this is necessary because there are  dialogs listening
    171                 // for DataChangeEvents which manipulate Swing components on this
    172                 // thread.
     168                // for DataChangeEvents which manipulate Swing components on this thread.
    173169                //
    174170                SwingUtilities.invokeLater(
  • trunk/src/org/openstreetmap/josm/gui/layer/geoimage/GeoImageLayer.java

    r9751 r9999  
    5656import org.openstreetmap.josm.gui.dialogs.LayerListDialog;
    5757import org.openstreetmap.josm.gui.dialogs.LayerListPopup;
     58import org.openstreetmap.josm.gui.layer.AbstractModifiableLayer;
    5859import org.openstreetmap.josm.gui.layer.GpxLayer;
    5960import org.openstreetmap.josm.gui.layer.JumpToMarkerActions.JumpToMarkerLayer;
    6061import org.openstreetmap.josm.gui.layer.JumpToMarkerActions.JumpToNextMarker;
    6162import org.openstreetmap.josm.gui.layer.JumpToMarkerActions.JumpToPreviousMarker;
    62 import org.openstreetmap.josm.gui.layer.AbstractModifiableLayer;
    6363import org.openstreetmap.josm.gui.layer.Layer;
    6464import org.openstreetmap.josm.gui.util.GuiHelper;
     
    978978     */
    979979    public List<ImageEntry> getImages() {
    980         if (data == null) {
    981             return Collections.emptyList();
    982         }
    983         List<ImageEntry> copy = new ArrayList<>(data.size());
    984         for (ImageEntry ie : data) {
    985             copy.add(ie);
    986         }
    987         return copy;
     980        return data == null ? Collections.<ImageEntry>emptyList() : new ArrayList<>(data);
    988981    }
    989982
Note: See TracChangeset for help on using the changeset viewer.