Ignore:
Timestamp:
2015-05-07T01:27:41+02:00 (5 years ago)
Author:
Don-vip
Message:

fix squid:S1319 - Declarations should use Java collection interfaces rather than specific implementation classes

Location:
trunk/src/org/openstreetmap/josm/actions
Files:
24 edited

Legend:

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

    r8285 r8338  
    1313import java.util.LinkedList;
    1414import java.util.List;
     15import java.util.Set;
    1516
    1617import javax.swing.JOptionPane;
     
    133134        List<Node> nodes = new LinkedList<>();
    134135        // fixNodes: All nodes for which the angle relative to center should not be modified
    135         HashSet<Node> fixNodes = new HashSet<>();
     136        Set<Node> fixNodes = new HashSet<>();
    136137        List<Way> ways = new LinkedList<>();
    137138        EastNorth center = null;
     
    156157            Way closedWay = new Way(w);
    157158            closedWay.addNode(w.firstNode());
    158             ArrayList<Way> usedWays = new ArrayList<>(1);
     159            List<Way> usedWays = new ArrayList<>(1);
    159160            usedWays.add(closedWay);
    160161            nodes = collectNodesAnticlockwise(usedWays);
    161162        } else if (!ways.isEmpty() && checkWaysArePolygon(ways)) {
    162163            // Case 2
    163             ArrayList<Node> inside = new ArrayList<>();
    164             ArrayList<Node> outside = new ArrayList<>();
     164            List<Node> inside = new ArrayList<>();
     165            List<Node> outside = new ArrayList<>();
    165166
    166167            for(Node n: nodes) {
     
    287288     */
    288289    private List<Node> collectNodesWithExternReferers(List<Way> ways) {
    289         ArrayList<Node> withReferrers = new ArrayList<>();
     290        List<Node> withReferrers = new ArrayList<>();
    290291        for(Way w: ways)
    291292            for(Node n: w.getNodes())
     
    301302     */
    302303    private List<Node> collectNodesAnticlockwise(List<Way> ways) {
    303         ArrayList<Node> nodes = new ArrayList<>();
     304        List<Node> nodes = new ArrayList<>();
    304305        Node firstNode = ways.get(0).firstNode();
    305306        Node lastNode = null;
  • trunk/src/org/openstreetmap/josm/actions/AutoScaleAction.java

    r8308 r8338  
    271271            DataSet dataset = Main.main.getCurrentDataSet();
    272272            if(dataset != null) {
    273                 ArrayList<DataSource> dataSources = new ArrayList<>(dataset.getDataSources());
     273                List<DataSource> dataSources = new ArrayList<>(dataset.getDataSources());
    274274                int s = dataSources.size();
    275275                if(s > 0) {
  • trunk/src/org/openstreetmap/josm/actions/CombineWayAction.java

    r8182 r8338  
    1111import java.util.Collection;
    1212import java.util.Collections;
    13 import java.util.HashSet;
    1413import java.util.LinkedHashMap;
    1514import java.util.LinkedHashSet;
     
    184183        List<Command> resolution = CombinePrimitiveResolverDialog.launchIfNecessary(wayTags, ways, Collections.singleton(targetWay));
    185184
    186         LinkedList<Command> cmds = new LinkedList<>();
    187         LinkedList<Way> deletedWays = new LinkedList<>(ways);
     185        List<Command> cmds = new LinkedList<>();
     186        List<Way> deletedWays = new LinkedList<>(ways);
    188187        deletedWays.remove(targetWay);
    189188
     
    561560
    562561        protected Set<Node> getNodes(Stack<NodePair> pairs) {
    563             HashSet<Node> nodes = new LinkedHashSet<>(2*pairs.size());
     562            Set<Node> nodes = new LinkedHashSet<>(2*pairs.size());
    564563            for (NodePair pair: pairs) {
    565564                nodes.add(pair.getA());
     
    594593
    595594        protected List<Node> buildPathFromNodePairs(Stack<NodePair> path) {
    596             LinkedList<Node> ret = new LinkedList<>();
     595            List<Node> ret = new LinkedList<>();
    597596            for (NodePair pair: path) {
    598597                ret.add(pair.getA());
  • trunk/src/org/openstreetmap/josm/actions/ExtensionFileFilter.java

    r7732 r8338  
    164164    public static List<ExtensionFileFilter> getImportExtensionFileFilters() {
    165165        updateAllFormatsImporter();
    166         LinkedList<ExtensionFileFilter> filters = new LinkedList<>();
     166        List<ExtensionFileFilter> filters = new LinkedList<>();
    167167        for (FileImporter importer : importers) {
    168168            filters.add(importer.filter);
     
    181181     */
    182182    public static List<ExtensionFileFilter> getExportExtensionFileFilters() {
    183         LinkedList<ExtensionFileFilter> filters = new LinkedList<>();
     183        List<ExtensionFileFilter> filters = new LinkedList<>();
    184184        for (FileExporter exporter : exporters) {
    185185            if (filters.contains(exporter.filter) || !exporter.isEnabled()) {
  • trunk/src/org/openstreetmap/josm/actions/JoinAreasAction.java

    r8308 r8338  
    10711071        // This seems to appear when is apply over invalid way like #9911 test-case
    10721072        // Remove all of these way to make the next work.
    1073         ArrayList<WayInPolygon> cleanMultigonWays = new ArrayList<>();
     1073        List<WayInPolygon> cleanMultigonWays = new ArrayList<>();
    10741074        for(WayInPolygon way: multigonWays)
    10751075            if(way.way.getNodesCount() == 2 && way.way.firstNode() == way.way.lastNode())
     
    10831083        WayInPolygon startWay;
    10841084        while((startWay = traverser.startNewWay()) != null) {
    1085             ArrayList<WayInPolygon> path = new ArrayList<>();
     1085            List<WayInPolygon> path = new ArrayList<>();
    10861086            List<WayInPolygon> startWays = new ArrayList<>();
    10871087            path.add(startWay);
  • trunk/src/org/openstreetmap/josm/actions/OrthogonalizeAction.java

    r7859 r8338  
    283283
    284284        // put the nodes of all ways in a set
    285         final HashSet<Node> allNodes = new HashSet<>();
     285        final Set<Node> allNodes = new HashSet<>();
    286286        for (WayData w : wayDataList) {
    287287            for (Node n : w.way.getNodes()) {
     
    291291
    292292        // the new x and y value for each node
    293         final HashMap<Node, Double> nX = new HashMap<>();
    294         final HashMap<Node, Double> nY = new HashMap<>();
     293        final Map<Node, Double> nX = new HashMap<>();
     294        final Map<Node, Double> nY = new HashMap<>();
    295295
    296296        // calculate the centroid of all nodes
     
    314314        final Direction[][] ORIENTATIONS = {HORIZONTAL, VERTICAL};
    315315        for (Direction[] orientation : ORIENTATIONS){
    316             final HashSet<Node> s = new HashSet<>(allNodes);
     316            final Set<Node> s = new HashSet<>(allNodes);
    317317            int s_size = s.size();
    318318            for (int dummy = 0; dummy < s_size; ++dummy) {
     
    322322                final Node dummy_n = s.iterator().next();     // pick arbitrary element of s
    323323
    324                 final HashSet<Node> cs = new HashSet<>(); // will contain each node that can be reached from dummy_n
    325                 cs.add(dummy_n);                              // walking only on horizontal / vertical segments
     324                final Set<Node> cs = new HashSet<>(); // will contain each node that can be reached from dummy_n
     325                cs.add(dummy_n);                      // walking only on horizontal / vertical segments
    326326
    327327                boolean somethingHappened = true;
     
    349349                }
    350350
    351                 final HashMap<Node, Double> nC = (orientation == HORIZONTAL) ? nY : nX;
     351                final Map<Node, Double> nC = (orientation == HORIZONTAL) ? nY : nX;
    352352
    353353                double average = 0;
  • trunk/src/org/openstreetmap/josm/actions/PasteTagsAction.java

    r7005 r8338  
    119119
    120120        protected Map<OsmPrimitiveType, Integer> getSourceStatistics() {
    121             HashMap<OsmPrimitiveType, Integer> ret = new HashMap<>();
     121            Map<OsmPrimitiveType, Integer> ret = new HashMap<>();
    122122            for (OsmPrimitiveType type: OsmPrimitiveType.dataValues()) {
    123123                if (!getSourceTagsByType(type).isEmpty()) {
     
    129129
    130130        protected Map<OsmPrimitiveType, Integer> getTargetStatistics() {
    131             HashMap<OsmPrimitiveType, Integer> ret = new HashMap<>();
     131            Map<OsmPrimitiveType, Integer> ret = new HashMap<>();
    132132            for (OsmPrimitiveType type: OsmPrimitiveType.dataValues()) {
    133133                int count = OsmPrimitive.getFilteredList(target, type.getOsmClass()).size();
  • trunk/src/org/openstreetmap/josm/actions/PurgeAction.java

    r8308 r8338  
    101101        // Add referrer, unless the object to purge is not new
    102102        // and the parent is a relation
    103         HashSet<OsmPrimitive> toPurgeRecursive = new HashSet<>();
     103        Set<OsmPrimitive> toPurgeRecursive = new HashSet<>();
    104104        while (!toPurge.isEmpty()) {
    105105
  • trunk/src/org/openstreetmap/josm/actions/SelectByInternalPointAction.java

    r8114 r8338  
    66import java.util.Collection;
    77import java.util.Collections;
     8import java.util.Map;
    89import java.util.TreeMap;
    910
     
    3940        }
    4041        final Node n = new Node(internalPoint);
    41         final TreeMap<Double, OsmPrimitive> found = new TreeMap<>();
     42        final Map<Double, OsmPrimitive> found = new TreeMap<>();
    4243        for (Way w : ds.getWays()) {
    4344            if (w.isUsable() && w.isClosed() && w.isSelectable()) {
  • trunk/src/org/openstreetmap/josm/actions/SelectNonBranchingWaySequences.java

    r8285 r8338  
    135135    public void extend(DataSet data) {
    136136        Collection<OsmPrimitive> currentSelection;
    137         LinkedList<OsmPrimitive> selection;
     137        Collection<OsmPrimitive> selection;
    138138        boolean selectionChanged = false;
    139139        Way way;
  • trunk/src/org/openstreetmap/josm/actions/SimplifyWayAction.java

    r7509 r8338  
    1414import java.util.LinkedList;
    1515import java.util.List;
     16import java.util.Set;
    1617
    1718import javax.swing.JOptionPane;
     
    191192        }
    192193
    193         HashSet<Node> delNodes = new HashSet<>();
     194        Set<Node> delNodes = new HashSet<>();
    194195        delNodes.addAll(w.getNodes());
    195196        delNodes.removeAll(newNodes);
  • trunk/src/org/openstreetmap/josm/actions/UnGlueAction.java

    r8318 r8338  
    167167     */
    168168    private void unglueNode(ActionEvent e) {
    169         LinkedList<Command> cmds = new LinkedList<>();
     169        List<Command> cmds = new LinkedList<>();
    170170
    171171        Node c = new Node(selectedNode);
     
    332332            }
    333333            Relation newRel = null;
    334             HashMap<String, Integer> rolesToReAdd = null; // <role name, index>
     334            Map<String, Integer> rolesToReAdd = null; // <role name, index>
    335335            int i = 0;
    336336            for (RelationMember rm : r.getMembers()) {
     
    361361     */
    362362    private void unglueWays() {
    363         LinkedList<Command> cmds = new LinkedList<>();
    364         LinkedList<Node> newNodes = new LinkedList<>();
     363        List<Command> cmds = new LinkedList<>();
     364        List<Node> newNodes = new LinkedList<>();
    365365
    366366        if (selectedWay == null) {
     
    409409    private boolean unglueSelfCrossingWay() {
    410410        // According to previous check, only one valid way through that node
    411         LinkedList<Command> cmds = new LinkedList<>();
     411        List<Command> cmds = new LinkedList<>();
    412412        Way way = null;
    413413        for (Way w: OsmPrimitive.getFilteredList(selectedNode.getReferrers(), Way.class))
     
    416416            }
    417417        List<Node> oldNodes = way.getNodes();
    418         ArrayList<Node> newNodes = new ArrayList<>(oldNodes.size());
    419         ArrayList<Node> addNodes = new ArrayList<>();
     418        List<Node> newNodes = new ArrayList<>(oldNodes.size());
     419        List<Node> addNodes = new ArrayList<>();
    420420        boolean seen = false;
    421421        for (Node n: oldNodes) {
     
    451451     */
    452452    private void unglueWays2() {
    453         LinkedList<Command> cmds = new LinkedList<>();
     453        List<Command> cmds = new LinkedList<>();
    454454        List<Node> allNewNodes = new LinkedList<>();
    455455        Way tmpWay = selectedWay;
  • trunk/src/org/openstreetmap/josm/actions/UploadAction.java

    r7402 r8338  
    1010import java.util.LinkedList;
    1111import java.util.List;
     12import java.util.Map;
    1213
    1314import javax.swing.JOptionPane;
     
    239240            @Override
    240241            public void run() {
    241                 final HashMap<String, String> tags = new HashMap<>(layer.data.getChangeSetTags());
     242                final Map<String, String> tags = new HashMap<>(layer.data.getChangeSetTags());
    242243                if (!tags.containsKey("source")) {
    243244                    tags.put("source", dialog.getLastChangesetSourceFromHistory());
  • trunk/src/org/openstreetmap/josm/actions/UploadSelectionAction.java

    r8291 r8338  
    6969
    7070    protected Set<OsmPrimitive> getDeletedPrimitives(DataSet ds) {
    71         HashSet<OsmPrimitive> ret = new HashSet<>();
     71        Set<OsmPrimitive> ret = new HashSet<>();
    7272        for (OsmPrimitive p: ds.allPrimitives()) {
    7373            if (p.isDeleted() && !p.isNew() && p.isVisible() && p.isModified()) {
     
    7979
    8080    protected Set<OsmPrimitive> getModifiedPrimitives(Collection<OsmPrimitive> primitives) {
    81         HashSet<OsmPrimitive> ret = new HashSet<>();
     81        Set<OsmPrimitive> ret = new HashSet<>();
    8282        for (OsmPrimitive p: primitives) {
    8383            if (p.isNewOrUndeleted()) {
     
    306306         */
    307307        protected Set<OsmPrimitive> getPrimitivesToCheckForParents() {
    308             HashSet<OsmPrimitive> ret = new HashSet<>();
     308            Set<OsmPrimitive> ret = new HashSet<>();
    309309            for (OsmPrimitive p: toUpload) {
    310310                if (p.isDeleted() && !p.isNewOrUndeleted()) {
  • trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadTaskList.java

    r7005 r8338  
    126126     */
    127127    protected Set<OsmPrimitive> getCompletePrimitives(DataSet ds) {
    128         HashSet<OsmPrimitive> ret = new HashSet<>();
     128        Set<OsmPrimitive> ret = new HashSet<>();
    129129        for (OsmPrimitive primitive : ds.allPrimitives()) {
    130130            if (!primitive.isIncomplete() && !primitive.isNew()) {
     
    216216     */
    217217    public Set<OsmPrimitive> getDownloadedPrimitives() {
    218         HashSet<OsmPrimitive> ret = new HashSet<>();
     218        Set<OsmPrimitive> ret = new HashSet<>();
    219219        for (DownloadTask task : tasks) {
    220220            if (task instanceof DownloadOsmTask) {
     
    253253                }
    254254            }
    255             LinkedHashSet<Object> errors = new LinkedHashSet<>();
     255            Set<Object> errors = new LinkedHashSet<>();
    256256            for (DownloadTask dt : tasks) {
    257257                errors.addAll(dt.getErrorObjects());
  • trunk/src/org/openstreetmap/josm/actions/downloadtasks/PostDownloadHandler.java

    r7005 r8338  
    88import java.util.LinkedHashSet;
    99import java.util.List;
     10import java.util.Set;
    1011import java.util.concurrent.Future;
    1112
     
    7778        // make sure errors are reported only once
    7879        //
    79         LinkedHashSet<Object> errors = new LinkedHashSet<>();
     80        Set<Object> errors = new LinkedHashSet<>();
    8081        errors.addAll(task.getErrorObjects());
    8182        if (errors.isEmpty())
  • trunk/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java

    r8308 r8338  
    950950
    951951    private static void pruneSuccsAndReverse(List<Integer> is) {
    952         HashSet<Integer> is2 = new HashSet<>();
     952        Set<Integer> is2 = new HashSet<>();
    953953        for (int i : is) {
    954954            if (!is2.contains(i - 1) && !is2.contains(i + 1)) {
  • trunk/src/org/openstreetmap/josm/actions/mapmode/ExtrudeAction.java

    r8308 r8338  
    101101     * Collection of nodes that is moved
    102102     */
    103     private ArrayList<Node> movingNodeList;
     103    private List<Node> movingNodeList;
    104104
    105105    /**
     
    626626        boolean segmentAngleZero = prevNode != null && Math.abs(Geometry.getCornerAngle(prevNode.getEastNorth(), initialN1en, newN1en)) < 1e-5;
    627627        boolean hasOtherWays = hasNodeOtherWays(selectedSegment.getFirstNode(), selectedSegment.way);
    628         ArrayList<Node> changedNodes = new ArrayList<>();
     628        List<Node> changedNodes = new ArrayList<>();
    629629        if (nodeOverlapsSegment && !alwaysCreateNodes && !hasOtherWays) {
    630630            //move existing node
  • trunk/src/org/openstreetmap/josm/actions/mapmode/ParallelWays.java

    r8285 r8338  
    88import java.util.HashSet;
    99import java.util.List;
     10import java.util.Map;
    1011import java.util.Set;
    1112
     
    4041        // Make a deep copy of the ways, keeping the copied ways connected
    4142        // TODO: This assumes the first/last nodes of the ways are the only possible shared nodes.
    42         HashMap<Node, Node> splitNodeMap = new HashMap<>(sourceWays.size());
     43        Map<Node, Node> splitNodeMap = new HashMap<>(sourceWays.size());
    4344        for (Way w : sourceWays) {
    4445            if (!splitNodeMap.containsKey(w.firstNode())) {
  • trunk/src/org/openstreetmap/josm/actions/mapmode/SelectAction.java

    r8318 r8338  
    248248        determineMapMode(!c.isEmpty());
    249249
    250         HashSet<OsmPrimitive> newHighlights = new HashSet<>();
     250        Set<OsmPrimitive> newHighlights = new HashSet<>();
    251251
    252252        virtualManager.clear();
  • trunk/src/org/openstreetmap/josm/actions/relation/SelectMembersAction.java

    r7937 r8338  
    66import java.awt.event.ActionEvent;
    77import java.util.HashSet;
     8import java.util.Set;
    89
    910import org.openstreetmap.josm.Main;
     
    1718 */
    1819public class SelectMembersAction extends AbstractRelationAction {
    19    
     20
    2021    private final boolean add;
    2122
     
    3536    public void actionPerformed(ActionEvent e) {
    3637        if (!isEnabled() || relations.isEmpty() || !Main.isDisplayingMapView()) return;
    37        
    38         HashSet<OsmPrimitive> members = new HashSet<>();
     38
     39        Set<OsmPrimitive> members = new HashSet<>();
    3940        for (Relation r: relations) {
    4041            members.addAll(r.getMemberPrimitives());
  • trunk/src/org/openstreetmap/josm/actions/search/SearchAction.java

    r8332 r8338  
    2323import java.util.List;
    2424import java.util.Map;
     25import java.util.Set;
    2526
    2627import javax.swing.ButtonGroup;
     
    109110            searchHistory.removeLast();
    110111        }
    111         LinkedHashSet<String> savedHistory = new LinkedHashSet<>(searchHistory.size());
     112        Set<String> savedHistory = new LinkedHashSet<>(searchHistory.size());
    112113        for (SearchSetting item: searchHistory) {
    113114            savedHistory.add(item.writeToString());
  • trunk/src/org/openstreetmap/josm/actions/upload/DiscardTagsHook.java

    r7937 r8338  
    44import static org.openstreetmap.josm.tools.I18n.tr;
    55
    6 import java.util.AbstractMap;
    76import java.util.Collection;
    87import java.util.HashMap;
    98import java.util.HashSet;
    109import java.util.List;
     10import java.util.Map;
    1111
    1212import org.openstreetmap.josm.Main;
     
    3737
    3838        if (needsChange) {
    39             AbstractMap<String, String> map = new HashMap<>();
     39            Map<String, String> map = new HashMap<>();
    4040            for (String key : discardableKeys) {
    4141                map.put(key, null);
  • trunk/src/org/openstreetmap/josm/actions/upload/FixDataHook.java

    r8285 r8338  
    190190
    191191        for (OsmPrimitive osm : objectsToUpload) {
    192             HashMap<String, String> keys = new HashMap<>(osm.getKeys());
     192            Map<String, String> keys = new HashMap<>(osm.getKeys());
    193193            if(!keys.isEmpty()) {
    194194                boolean modified = false;
Note: See TracChangeset for help on using the changeset viewer.