Ignore:
Timestamp:
2017-09-15T01:20:41+02:00 (2 years ago)
Author:
Don-vip
Message:

see #11390 - SonarQube - squid:S3824 - "Map.get" and value test should be replaced with single method call

Location:
trunk/src/org/openstreetmap/josm/data/osm
Files:
2 edited

Legend:

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

    r12537 r12865  
    7474        }
    7575
    76         Long ouid = uid;
    77         User user = userMap.get(ouid);
    78         if (user == null) {
    79             user = new User(uid, name);
    80             userMap.put(ouid, user);
    81         }
     76        User user = userMap.computeIfAbsent(uid, k -> new User(uid, name));
    8277        if (name != null) user.addName(name);
    8378
  • trunk/src/org/openstreetmap/josm/data/osm/history/HistoryDataSet.java

    r12636 r12865  
    125125    public void put(HistoryOsmPrimitive primitive) {
    126126        PrimitiveId id = new SimplePrimitiveId(primitive.getId(), primitive.getType());
    127         if (data.get(id) == null) {
    128             data.put(id, new ArrayList<HistoryOsmPrimitive>());
    129         }
    130         data.get(id).add(primitive);
     127        data.computeIfAbsent(id, k-> new ArrayList<>()).add(primitive);
    131128        fireHistoryUpdated(id);
    132129    }
Note: See TracChangeset for help on using the changeset viewer.