Changeset 11516 in josm


Ignore:
Timestamp:
2017-01-31T22:58:50+01:00 (8 years ago)
Author:
Don-vip
Message:

sonar - fb-contrib:SPP_USE_GET0 - Performance - Method uses iterator().next() on a List to get the first item

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

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/imagery/WMTSTileSource.java

    r11460 r11516  
    227227                return null; //nothing selected
    228228            }
    229             Layer selectedLayer = layers.get(index).getValue().iterator().next();
     229            Layer selectedLayer = layers.get(index).getValue().get(0);
    230230            return new WMTSDefaultLayer(selectedLayer.name, selectedLayer.tileMatrixSet.identifier);
    231231        }
     
    270270        // if there is only one layer name no point in asking
    271271        if (grouppedLayers.size() == 1) {
    272             Layer selectedLayer = grouppedLayers.iterator().next().getValue().iterator().next();
     272            Layer selectedLayer = grouppedLayers.iterator().next().getValue().get(0);
    273273            return new WMTSDefaultLayer(selectedLayer.name, selectedLayer.tileMatrixSet.identifier);
    274274        }
  • trunk/src/org/openstreetmap/josm/io/OverpassDownloadReader.java

    r11366 r11516  
    115115        try {
    116116            final List<NameFinder.SearchResult> results = NameFinder.queryNominatim(area);
    117             final PrimitiveId osmId = results.iterator().next().getOsmId();
     117            final PrimitiveId osmId = results.get(0).getOsmId();
    118118            return String.format("area(%d)", osmId.getUniqueId() + idOffset.get(osmId.getType()));
    119119        } catch (IOException | NoSuchElementException ex) {
  • trunk/src/org/openstreetmap/josm/tools/Geometry.java

    r11378 r11516  
    8888
    8989        OsmDataLayer layer = Main.getLayerManager().getEditLayer();
    90         DataSet dataset = ways.iterator().next().getDataSet();
     90        DataSet dataset = ways.get(0).getDataSet();
    9191
    9292        //iterate over all way pairs and introduce the intersections
Note: See TracChangeset for help on using the changeset viewer.