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/gui/MapViewState.java

    r11470 r11553  
    1212import java.io.Serializable;
    1313import java.util.Objects;
     14import java.util.Optional;
    1415
    1516import javax.swing.JComponent;
     
    376377
    377378    private static EastNorth calculateDefaultCenter() {
    378         Bounds b = DownloadDialog.getSavedDownloadBounds();
    379         if (b == null) {
    380             b = Main.getProjection().getWorldBoundsLatLon();
    381         }
     379        Bounds b = Optional.ofNullable(DownloadDialog.getSavedDownloadBounds()).orElseGet(
     380                () -> Main.getProjection().getWorldBoundsLatLon());
    382381        return Main.getProjection().latlon2eastNorth(b.getCenter());
    383382    }
Note: See TracChangeset for help on using the changeset viewer.