Changeset 15905 in josm


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

Use Collections.singletonMap

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

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/command/ChangePropertyCommand.java

    r12769 r15905  
    66import static org.openstreetmap.josm.tools.I18n.trn;
    77
    8 import java.util.Arrays;
    98import java.util.Collection;
    109import java.util.Collections;
    11 import java.util.HashMap;
    1210import java.util.LinkedList;
    1311import java.util.List;
     
    107105    public ChangePropertyCommand(Collection<? extends OsmPrimitive> objects, String key, String value) {
    108106        super(objects.iterator().next().getDataSet());
    109         this.tags = new HashMap<>(1);
    110         this.tags.put(key, value);
     107        this.tags = Collections.singletonMap(key, value);
    111108        init(objects);
    112109    }
     
    121118     */
    122119    public ChangePropertyCommand(OsmPrimitive object, String key, String value) {
    123         this(Arrays.asList(object), key, value);
     120        this(Collections.singleton(object), key, value);
    124121    }
    125122
  • trunk/src/org/openstreetmap/josm/gui/datatransfer/importers/PrimitiveTagTransferPaster.java

    r14153 r15905  
    77import java.util.Arrays;
    88import java.util.Collection;
     9import java.util.Collections;
    910import java.util.EnumMap;
    10 import java.util.HashMap;
    1111import java.util.List;
    1212import java.util.Map;
     
    5252        List<Command> commands = new ArrayList<>();
    5353        for (Tag tag : tagPaster.execute()) {
    54             Map<String, String> tags = new HashMap<>(1);
    55             tags.put(tag.getKey(), "".equals(tag.getValue()) ? null : tag.getValue());
     54            Map<String, String> tags = Collections.singletonMap(tag.getKey(), "".equals(tag.getValue()) ? null : tag.getValue());
    5655            ChangePropertyCommand cmd = new ChangePropertyCommand(OsmDataManager.getInstance().getEditDataSet(), selection, tags);
    5756            if (cmd.getObjectsNumber() > 0) {
  • trunk/src/org/openstreetmap/josm/io/GeoJSONWriter.java

    r15429 r15905  
    66import java.math.RoundingMode;
    77import java.util.Collection;
    8 import java.util.HashMap;
     8import java.util.Collections;
    99import java.util.HashSet;
    1010import java.util.Iterator;
     
    8080    public String write(boolean pretty) {
    8181        StringWriter stringWriter = new StringWriter();
    82         Map<String, Object> config = new HashMap<>(1);
    83         config.put(JsonGenerator.PRETTY_PRINTING, pretty);
     82        Map<String, Object> config = Collections.singletonMap(JsonGenerator.PRETTY_PRINTING, pretty);
    8483        try (JsonWriter writer = Json.createWriterFactory(config).createWriter(stringWriter)) {
    8584            JsonObjectBuilder object = Json.createObjectBuilder()
Note: See TracChangeset for help on using the changeset viewer.