Changeset 10044 in josm


Ignore:
Timestamp:
2016-03-26T14:57:43+01:00 (4 years ago)
Author:
Don-vip
Message:

sonar - squid:S1641 - Sets with elements that are enum values should be replaced with EnumSet

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

Legend:

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

    r10001 r10044  
    2525import java.util.Collection;
    2626import java.util.Collections;
     27import java.util.EnumSet;
    2728import java.util.HashMap;
    28 import java.util.HashSet;
    2929import java.util.Iterator;
    3030import java.util.List;
     
    232232    private static final List<String> ERRORS_AND_WARNINGS = Collections.<String>synchronizedList(new ArrayList<String>());
    233233
    234     private static final Set<OnlineResource> OFFLINE_RESOURCES = new HashSet<>();
     234    private static final Set<OnlineResource> OFFLINE_RESOURCES = EnumSet.noneOf(OnlineResource.class);
    235235
    236236    /**
     
    18251825     */
    18261826    public static Set<OnlineResource> getOfflineResources() {
    1827         return new HashSet<>(OFFLINE_RESOURCES);
     1827        return EnumSet.copyOf(OFFLINE_RESOURCES);
    18281828    }
    18291829}
  • trunk/src/org/openstreetmap/josm/gui/DefaultNameFormatter.java

    r10001 r10044  
    332332    }
    333333
    334     private StringBuilder formatRelationNameAndType(Relation relation, StringBuilder result, TaggingPreset preset) {
     334    private static StringBuilder formatRelationNameAndType(Relation relation, StringBuilder result, TaggingPreset preset) {
    335335        if (preset == null) {
    336336            result.append(getRelationTypeName(relation));
  • trunk/src/org/openstreetmap/josm/gui/dialogs/OsmIdSelectionDialog.java

    r9972 r10044  
    1515import java.util.Collection;
    1616import java.util.Collections;
    17 import java.util.HashSet;
     17import java.util.EnumSet;
    1818import java.util.LinkedList;
    1919import java.util.List;
     
    214214            }));
    215215            tfId.tryToPasteFrom(parsedText);
    216             final Set<OsmPrimitiveType> types = new HashSet<>(Utils.transform(ids, new Utils.Function<SimplePrimitiveId, OsmPrimitiveType>() {
     216            final Set<OsmPrimitiveType> types = EnumSet.copyOf(Utils.transform(ids, new Utils.Function<SimplePrimitiveId, OsmPrimitiveType>() {
    217217                @Override
    218218                public OsmPrimitiveType apply(SimplePrimitiveId x) {
  • trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetNameTemplateList.java

    r8863 r10044  
    33
    44import java.util.Collection;
    5 import java.util.Collections;
     5import java.util.EnumSet;
    66import java.util.LinkedList;
    77import java.util.List;
     
    5555        synchronized (this) {
    5656            for (TaggingPreset t : presetsWithPattern) {
    57                 Collection<TaggingPresetType> type = Collections.singleton(TaggingPresetType.forPrimitive(primitive));
     57                Collection<TaggingPresetType> type = EnumSet.of(TaggingPresetType.forPrimitive(primitive));
    5858                if (t.typeMatches(type)) {
    5959                    if (t.nameTemplateFilter != null) {
Note: See TracChangeset for help on using the changeset viewer.