Changeset 15906 in josm for trunk/src/org/openstreetmap


Ignore:
Timestamp:
2020-02-23T00:29:48+01:00 (5 years ago)
Author:
simon04
Message:

Use Utils.hashMapInitialCapacity

Location:
trunk/src/org/openstreetmap/josm
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/mapmode/ParallelWays.java

    r15557 r15906  
    2222import org.openstreetmap.josm.data.osm.Way;
    2323import org.openstreetmap.josm.tools.Geometry;
     24import org.openstreetmap.josm.tools.Utils;
    2425
    2526/**
     
    4849        // Make a deep copy of the ways, keeping the copied ways connected
    4950        // TODO: This assumes the first/last nodes of the ways are the only possible shared nodes.
    50         Map<Node, Node> splitNodeMap = new HashMap<>(sourceWays.size());
     51        Map<Node, Node> splitNodeMap = new HashMap<>(Utils.hashMapInitialCapacity(sourceWays.size()));
    5152        for (Way w : sourceWays) {
    5253            copyNodeInMap(splitNodeMap, w.firstNode(), copyTags);
  • trunk/src/org/openstreetmap/josm/data/StructUtils.java

    r15121 r15906  
    3434import org.openstreetmap.josm.tools.MultiMap;
    3535import org.openstreetmap.josm.tools.ReflectionUtils;
     36import org.openstreetmap.josm.tools.Utils;
    3637
    3738/**
     
    270271        try (JsonReader reader = Json.createReader(new StringReader(s))) {
    271272            JsonObject object = reader.readObject();
    272             ret = new HashMap(object.size());
     273            ret = new HashMap(Utils.hashMapInitialCapacity(object.size()));
    273274            for (Map.Entry<String, JsonValue> e: object.entrySet()) {
    274275                JsonValue value = e.getValue();
  • trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java

    r15876 r15906  
    10851085        protected void deleteTags(int... rows) {
    10861086            // convert list of rows to HashMap (and find gap for nextKey)
    1087             Map<String, String> tags = new HashMap<>(rows.length);
     1087            Map<String, String> tags = new HashMap<>(Utils.hashMapInitialCapacity(rows.length));
    10881088            int nextKeyIndex = rows[0];
    10891089            for (int row : rows) {
  • trunk/src/org/openstreetmap/josm/tools/ImageResource.java

    r13652 r15906  
    3131     * Caches the image data for resized versions of the same image.
    3232     */
    33     private final Map<Dimension, BufferedImage> imgCache = new HashMap<>();
     33    private final Map<Dimension, BufferedImage> imgCache = new HashMap<>(4);
    3434    /**
    3535     * SVG diagram information in case of SVG vector image.
Note: See TracChangeset for help on using the changeset viewer.