Changeset 16912 in josm for trunk


Ignore:
Timestamp:
2020-08-23T15:30:52+02:00 (4 years ago)
Author:
simon04
Message:

Java 8: use Stream

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/bbox/SlippyMapBBoxChooser.java

    r16894 r16912  
    126126
    127127        String mapStyle = PROP_MAPSTYLE.get();
    128         boolean foundSource = false;
    129         for (TileSource source: tileSources) {
    130             if (source.getName().equals(mapStyle)) {
    131                 this.setTileSource(source);
    132                 iSourceButton.setCurrentMap(source);
    133                 foundSource = true;
    134                 break;
    135             }
    136         }
    137         if (!foundSource) {
    138             setTileSource(tileSources.get(0));
    139             iSourceButton.setCurrentMap(tileSources.get(0));
    140         }
     128        final TileSource tileSource = tileSources.stream()
     129                .filter(source -> source.getName().equals(mapStyle))
     130                .findFirst()
     131                .orElse(tileSources.get(0));
     132        setTileSource(tileSource);
     133        iSourceButton.setCurrentMap(tileSource);
    141134
    142135        MainApplication.getLayerManager().addActiveLayerChangeListener(this);
Note: See TracChangeset for help on using the changeset viewer.