Ignore:
Timestamp:
2017-02-12T16:32:18+01:00 (7 years ago)
Author:
Don-vip
Message:

refactor handling of null values - use Java 8 Optional where possible

File:
1 edited

Legend:

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

    r11452 r11553  
    1111import java.util.Map;
    1212import java.util.Map.Entry;
     13import java.util.Optional;
    1314import java.util.Set;
    1415import java.util.concurrent.ConcurrentHashMap;
     
    9091        if (tile != null) {
    9192            TileSource tileSource = tile.getTileSource();
    92             String tsName = tileSource.getName();
    93             if (tsName == null) {
    94                 tsName = "";
    95             }
    96             return tsName.replace(':', '_') + ':' + tileSource.getTileId(tile.getZoom(), tile.getXtile(), tile.getYtile());
     93            return Optional.ofNullable(tileSource.getName()).orElse("").replace(':', '_') + ':'
     94                    + tileSource.getTileId(tile.getZoom(), tile.getXtile(), tile.getYtile());
    9795        }
    9896        return null;
Note: See TracChangeset for help on using the changeset viewer.