Changeset 16101 in josm for trunk/src


Ignore:
Timestamp:
2020-03-09T00:48:59+01:00 (4 years ago)
Author:
simon04
Message:

see #18896: ImageryInfo: use Utils.toUnmodifiableList and Utils.toUnmodifiableMap

File:
1 edited

Legend:

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

    r15934 r16101  
    1919import java.util.Set;
    2020import java.util.TreeSet;
    21 import java.util.concurrent.ConcurrentHashMap;
    2221import java.util.concurrent.TimeUnit;
    2322import java.util.regex.Matcher;
     
    305304    private boolean isGeoreferenceValid;
    306305    /** which layers should be activated by default on layer addition. **/
    307     private List<DefaultLayer> defaultLayers = new ArrayList<>();
     306    private List<DefaultLayer> defaultLayers = Collections.emptyList();
    308307    /** HTTP headers **/
    309     private Map<String, String> customHttpHeaders = new ConcurrentHashMap<>();
     308    private Map<String, String> customHttpHeaders = Collections.emptyMap();
    310309    /** Should this map be transparent **/
    311310    private boolean transparent = true;
     
    588587            }
    589588        }
    590         customHttpHeaders = e.customHttpHeaders;
     589        setCustomHttpHeaders(e.customHttpHeaders);
    591590        transparent = e.transparent;
    592591        minimumTileExpire = e.minimumTileExpire;
     
    635634        this.icon = intern(i.icon);
    636635        this.isGeoreferenceValid = i.isGeoreferenceValid;
    637         this.defaultLayers = i.defaultLayers;
    638         this.customHttpHeaders = i.customHttpHeaders;
     636        setDefaultLayers(i.defaultLayers);
     637        setCustomHttpHeaders(i.customHttpHeaders);
    639638        this.transparent = i.transparent;
    640639        this.minimumTileExpire = i.minimumTileExpire;
     
    15711570     */
    15721571    public void setDefaultLayers(List<DefaultLayer> layers) {
    1573         this.defaultLayers = layers;
     1572        this.defaultLayers = Utils.toUnmodifiableList(layers);
    15741573    }
    15751574
     
    15791578     */
    15801579    public Map<String, String> getCustomHttpHeaders() {
    1581         if (customHttpHeaders == null) {
    1582             return Collections.emptyMap();
    1583         }
    15841580        return customHttpHeaders;
    15851581    }
     
    15901586     */
    15911587    public void setCustomHttpHeaders(Map<String, String> customHttpHeaders) {
    1592         this.customHttpHeaders = customHttpHeaders;
     1588        this.customHttpHeaders = Utils.toUnmodifiableMap(customHttpHeaders);
    15931589    }
    15941590
Note: See TracChangeset for help on using the changeset viewer.