Changeset 9268 in josm for trunk/src/org


Ignore:
Timestamp:
2016-01-02T19:26:27+01:00 (9 years ago)
Author:
simon04
Message:

Avoid unnecessary creation of empty map when copying keys

Relates to #11653.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java

    r9267 r9268  
    11651165                        tr("Cannot merge primitives with different ids. This id is {0}, the other is {1}", id, other.getId()));
    11661166
    1167             setKeys(other.getKeys());
     1167            setKeys(other.hasKeys() ? other.getKeys() : null);
    11681168            timestamp = other.timestamp;
    11691169            version = other.version;
     
    12411241    public void load(PrimitiveData data) {
    12421242        // Write lock is provided by subclasses
    1243         setKeys(data.getKeys());
     1243        setKeys(data.hasKeys() ? data.getKeys() : null);
    12441244        setRawTimestamp(data.getRawTimestamp());
    12451245        user = data.getUser();
     
    12631263    protected void saveCommonAttributes(PrimitiveData data) {
    12641264        data.setId(id);
    1265         data.setKeys(getKeys());
     1265        data.setKeys(hasKeys() ? getKeys() : null);
    12661266        data.setRawTimestamp(getRawTimestamp());
    12671267        data.setUser(user);
Note: See TracChangeset for help on using the changeset viewer.