Ignore:
Timestamp:
2014-04-26T17:39:23+02:00 (10 years ago)
Author:
Don-vip
Message:

see #8465 - use diamond operator where applicable

Location:
trunk/src/org/openstreetmap/josm/data/validation
Files:
30 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/validation/OsmValidator.java

    r6995 r7005  
    7777    public static double griddetail;
    7878
    79     public static final Collection<String> ignoredErrors = new TreeSet<String>();
     79    public static final Collection<String> ignoredErrors = new TreeSet<>();
    8080
    8181    /**
     
    124124    private static Map<String, Test> allTestsMap;
    125125    static {
    126         allTestsMap = new HashMap<String, Test>();
     126        allTestsMap = new HashMap<>();
    127127        for (Class<Test> testClass : allAvailableTests) {
    128128            try {
     
    226226        applyPrefs(allTestsMap, false);
    227227        applyPrefs(allTestsMap, true);
    228         return new TreeMap<String, Test>(allTestsMap);
     228        return new TreeMap<>(allTestsMap);
    229229    }
    230230
     
    263263    public static Collection<Test> getEnabledTests(boolean beforeUpload) {
    264264        Collection<Test> enabledTests = getTests();
    265         for (Test t : new ArrayList<Test>(enabledTests)) {
     265        for (Test t : new ArrayList<>(enabledTests)) {
    266266            if (beforeUpload ? t.testBeforeUpload : t.enabled) {
    267267                continue;
  • trunk/src/org/openstreetmap/josm/data/validation/PaintVisitor.java

    r6009 r7005  
    3434    private boolean selected;
    3535   
    36     private final Set<PaintedPoint> paintedPoints = new HashSet<PaintedPoint>();
    37     private final Set<PaintedSegment> paintedSegments = new HashSet<PaintedSegment>();
     36    private final Set<PaintedPoint> paintedPoints = new HashSet<>();
     37    private final Set<PaintedSegment> paintedSegments = new HashSet<>();
    3838
    3939    /**
  • trunk/src/org/openstreetmap/josm/data/validation/Test.java

    r6990 r7005  
    5858
    5959    /** The list of errors */
    60     protected List<TestError> errors = new ArrayList<TestError>(30);
     60    protected List<TestError> errors = new ArrayList<>(30);
    6161
    6262    /** Whether the test is run on a partial selection data */
     
    152152        this.progressMonitor.beginTask(startMessage);
    153153        Main.debug(startMessage);
    154         this.errors = new ArrayList<TestError>(30);
     154        this.errors = new ArrayList<>(30);
    155155        this.startTime = System.currentTimeMillis();
    156156    }
     
    307307     */
    308308    protected final Command deletePrimitivesIfNeeded(Collection<? extends OsmPrimitive> primitives) {
    309         Collection<OsmPrimitive> primitivesToDelete = new ArrayList<OsmPrimitive>();
     309        Collection<OsmPrimitive> primitivesToDelete = new ArrayList<>();
    310310        for (OsmPrimitive p : primitives) {
    311311            if (!p.isDeleted()) {
  • trunk/src/org/openstreetmap/josm/data/validation/TestError.java

    r6804 r7005  
    133133     */
    134134    public Collection<? extends OsmPrimitive> getSelectablePrimitives() {
    135         List<OsmPrimitive> selectablePrimitives = new ArrayList<OsmPrimitive>(primitives.size());
     135        List<OsmPrimitive> selectablePrimitives = new ArrayList<>(primitives.size());
    136136        for (OsmPrimitive o : primitives) {
    137137            if (o.isSelectable()) {
     
    170170     */
    171171    public String getIgnoreState() {
    172         Collection<String> strings = new TreeSet<String>();
     172        Collection<String> strings = new TreeSet<>();
    173173        StringBuilder ignorestring = new StringBuilder(getIgnoreSubGroup());
    174174        for (OsmPrimitive o : primitives) {
  • trunk/src/org/openstreetmap/josm/data/validation/tests/Addresses.java

    r6826 r7005  
    117117        if (r.hasTag("type", ASSOCIATED_STREET)) {
    118118            // Used to count occurences of each house number in order to find duplicates
    119             Map<String, List<OsmPrimitive>> map = new HashMap<String, List<OsmPrimitive>>();
     119            Map<String, List<OsmPrimitive>> map = new HashMap<>();
    120120            // Used to detect different street names
    121121            String relationName = r.get("name");
    122             Set<OsmPrimitive> wrongStreetNames = new HashSet<OsmPrimitive>();
     122            Set<OsmPrimitive> wrongStreetNames = new HashSet<>();
    123123            // Used to check distance
    124             Set<OsmPrimitive> houses = new HashSet<OsmPrimitive>();
    125             Set<Way> street = new HashSet<Way>();
     124            Set<OsmPrimitive> houses = new HashSet<>();
     125            Set<Way> street = new HashSet<>();
    126126            for (RelationMember m : r.getMembers()) {
    127127                String role = m.getRole();
     
    134134                        List<OsmPrimitive> list = map.get(number);
    135135                        if (list == null) {
    136                             map.put(number, list = new ArrayList<OsmPrimitive>());
     136                            map.put(number, list = new ArrayList<>());
    137137                        }
    138138                        list.add(p);
  • trunk/src/org/openstreetmap/josm/data/validation/tests/Coastlines.java

    r6475 r7005  
    5959        }
    6060
    61         coastlines = new LinkedList<Way>();
     61        coastlines = new LinkedList<>();
    6262    }
    6363
     
    145145            }
    146146
    147             List<OsmPrimitive> primitives = new ArrayList<OsmPrimitive>();
     147            List<OsmPrimitive> primitives = new ArrayList<>();
    148148            primitives.add(c1);
    149149
    150150            if (headWays == 0 || tailWays == 0) {
    151                 List<OsmPrimitive> highlight = new ArrayList<OsmPrimitive>();
     151                List<OsmPrimitive> highlight = new ArrayList<>();
    152152
    153153                if (headWays == 0 && head.getCoor().isIn(downloadedArea)) {
     
    178178
    179179            if (unordered) {
    180                 List<OsmPrimitive> highlight = new ArrayList<OsmPrimitive>();
     180                List<OsmPrimitive> highlight = new ArrayList<>();
    181181
    182182                if (headWays > 1 || headUnordered || headReversed || reversed) {
  • trunk/src/org/openstreetmap/josm/data/validation/tests/ConditionalKeys.java

    r6625 r7005  
    2323
    2424    final OpeningHourTest openingHourTest = new OpeningHourTest();
    25     static final Set<String> RESTRICTION_TYPES = new HashSet<String>(Arrays.asList("oneway", "toll", "noexit", "maxspeed", "minspeed",
     25    static final Set<String> RESTRICTION_TYPES = new HashSet<>(Arrays.asList("oneway", "toll", "noexit", "maxspeed", "minspeed",
    2626            "maxweight", "maxaxleload", "maxheight", "maxwidth", "maxlength", "overtaking", "maxgcweight", "maxgcweightrating", "fee"));
    27     static final Set<String> RESTRICTION_VALUES = new HashSet<String>(Arrays.asList("yes", "official", "designated", "destination",
     27    static final Set<String> RESTRICTION_VALUES = new HashSet<>(Arrays.asList("yes", "official", "designated", "destination",
    2828            "delivery", "permissive", "private", "agricultural", "forestry", "no"));
    29     static final Set<String> TRANSPORT_MODES = new HashSet<String>(Arrays.asList("access", "foot", "ski", "inline_skates", "ice_skates",
     29    static final Set<String> TRANSPORT_MODES = new HashSet<>(Arrays.asList("access", "foot", "ski", "inline_skates", "ice_skates",
    3030            "horse", "vehicle", "bicycle", "carriage", "trailer", "caravan", "motor_vehicle", "motorcycle", "moped", "mofa",
    3131            "motorcar", "motorhome", "psv", "bus", "taxi", "tourist_bus", "goods", "hgv", "agricultural", "atv", "snowmobile"
    3232            /*,"hov","emergency","hazmat","disabled"*/));
    3333
     34    /**
     35     * Constructs a new {@code ConditionalKeys}.
     36     */
    3437    public ConditionalKeys() {
    3538        super(tr("Conditional Keys"), tr("Tests for the correct usage of ''*:conditional'' tags."));
     
    9497        public static List<ConditionalValue> parse(String value) throws ConditionalParsingException {
    9598            // <restriction-value> @ <condition>[;<restriction-value> @ <condition>]
    96             final List<ConditionalValue> r = new ArrayList<ConditionalValue>();
     99            final List<ConditionalValue> r = new ArrayList<>();
    97100            final Pattern part = Pattern.compile("([^@\\p{Space}][^@]*?)" + "\\s*@\\s*" + "(\\([^)\\p{Space}][^)]+?\\)|[^();\\p{Space}][^();]*?)\\s*");
    98101            final Matcher m = Pattern.compile("(" + part + ")(;\\s*" + part + ")*").matcher(value);
     
    137140
    138141    public List<TestError> validatePrimitive(OsmPrimitive p) {
    139         final List<TestError> errors = new ArrayList<TestError>();
     142        final List<TestError> errors = new ArrayList<>();
    140143        for (final String key : Utils.filter(p.keySet(), Predicates.stringMatchesPattern(Pattern.compile(".*:conditional$")))) {
    141144            if (!isKeyValid(key)) {
  • trunk/src/org/openstreetmap/josm/data/validation/tests/CrossingWays.java

    r6869 r7005  
    185185    public void startTest(ProgressMonitor monitor) {
    186186        super.startTest(monitor);
    187         cellSegments = new HashMap<Point2D,List<WaySegment>>(1000);
    188         errorSegments = new HashSet<WaySegment>();
    189         seenWays = new HashMap<List<Way>, List<WaySegment>>(50);
     187        cellSegments = new HashMap<>(1000);
     188        errorSegments = new HashSet<>();
     189        seenWays = new HashMap<>(50);
    190190    }
    191191
     
    247247                    prims = Arrays.asList(es1.way, es2.way);
    248248                    if ((highlight = seenWays.get(prims)) == null) {
    249                         highlight = new ArrayList<WaySegment>();
     249                        highlight = new ArrayList<>();
    250250                        highlight.add(es1);
    251251                        highlight.add(es2);
     
    278278    public List<List<WaySegment>> getSegments(EastNorth n1, EastNorth n2) {
    279279
    280         List<List<WaySegment>> cells = new ArrayList<List<WaySegment>>();
     280        List<List<WaySegment>> cells = new ArrayList<>();
    281281        for (Point2D cell : ValUtil.getSegmentCells(n1, n2, OsmValidator.griddetail)) {
    282282            List<WaySegment> segments = cellSegments.get(cell);
    283283            if (segments == null) {
    284                 segments = new ArrayList<WaySegment>();
     284                segments = new ArrayList<>();
    285285                cellSegments.put(cell, segments);
    286286            }
  • trunk/src/org/openstreetmap/josm/data/validation/tests/DuplicateNode.java

    r6883 r7005  
    118118    public void startTest(ProgressMonitor monitor) {
    119119        super.startTest(monitor);
    120         potentialDuplicates = new Storage<Object>(new NodeHash());
     120        potentialDuplicates = new Storage<>(new NodeHash());
    121121    }
    122122
     
    133133            // multiple nodes at the same position -> check if all nodes have a distinct elevation
    134134            List<Node> nodes = (List<Node>) v;
    135             Set<String> eles = new HashSet<String>();
     135            Set<String> eles = new HashSet<>();
    136136            for (Node n : nodes) {
    137137                String ele = n.get("ele");
     
    161161     */
    162162    public List<TestError> buildTestErrors(Test parentTest, List<Node> nodes) {
    163         List<TestError> errors = new ArrayList<TestError>();
    164 
    165         MultiMap<Map<String,String>, OsmPrimitive> mm = new MultiMap<Map<String,String>, OsmPrimitive>();
     163        List<TestError> errors = new ArrayList<>();
     164
     165        MultiMap<Map<String,String>, OsmPrimitive> mm = new MultiMap<>();
    166166        for (Node n: nodes) {
    167167            mm.put(n.getKeys(), n);
    168168        }
    169169
    170         Map<String,Boolean> typeMap=new HashMap<String,Boolean>();
     170        Map<String,Boolean> typeMap=new HashMap<>();
    171171        String[] types = {"none", "highway", "railway", "waterway", "boundary", "power", "natural", "landuse", "building"};
    172172
     
    334334        //
    335335        if (!mm.isEmpty()) {
    336             List<OsmPrimitive> duplicates = new ArrayList<OsmPrimitive>();
     336            List<OsmPrimitive> duplicates = new ArrayList<>();
    337337            for (Set<OsmPrimitive> l: mm.values()) {
    338338                duplicates.addAll(l);
     
    365365                //
    366366                Node n1 = (Node)potentialDuplicates.get(n);
    367                 List<Node> nodes = new ArrayList<Node>(2);
     367                List<Node> nodes = new ArrayList<>(2);
    368368                nodes.add(n1);
    369369                nodes.add(n);
     
    385385    public Command fixError(TestError testError) {
    386386        if (!isFixable(testError)) return null;
    387         Collection<OsmPrimitive> sel = new LinkedList<OsmPrimitive>(testError.getPrimitives());
    388         LinkedHashSet<Node> nodes = new LinkedHashSet<Node>(OsmPrimitive.getFilteredList(sel, Node.class));
     387        Collection<OsmPrimitive> sel = new LinkedList<>(testError.getPrimitives());
     388        LinkedHashSet<Node> nodes = new LinkedHashSet<>(OsmPrimitive.getFilteredList(sel, Node.class));
    389389
    390390        // Filter nodes that have already been deleted (see #5764 and #5773)
  • trunk/src/org/openstreetmap/josm/data/validation/tests/DuplicateRelation.java

    r6494 r7005  
    7272            type = src.getType();
    7373            relId = 0;
    74             coor = new ArrayList<LatLon>();
     74            coor = new ArrayList<>();
    7575
    7676            if (src.isNode()) {
    7777                Node r = src.getNode();
    7878                tags = r.getKeys();
    79                 coor = new ArrayList<LatLon>(1);
     79                coor = new ArrayList<>(1);
    8080                coor.add(r.getCoor());
    8181            }
     
    8484                tags = r.getKeys();
    8585                List<Node> wNodes = r.getNodes();
    86                 coor = new ArrayList<LatLon>(wNodes.size());
     86                coor = new ArrayList<>(wNodes.size());
    8787                for (Node wNode : wNodes) {
    8888                    coor.add(wNode.getCoor());
     
    9393                tags = r.getKeys();
    9494                relId = r.getId();
    95                 coor = new ArrayList<LatLon>();
     95                coor = new ArrayList<>();
    9696            }
    9797        }
     
    109109         */
    110110        public RelationMembers(List<RelationMember> members) {
    111             this.members = new ArrayList<RelMember>(members.size());
     111            this.members = new ArrayList<>(members.size());
    112112            for (RelationMember member : members) {
    113113                this.members.add(new RelMember(member));
     
    172172
    173173    /** List of keys without useful information */
    174     private final Set<String> ignoreKeys = new HashSet<String>(OsmPrimitive.getUninterestingKeys());
     174    private final Set<String> ignoreKeys = new HashSet<>(OsmPrimitive.getUninterestingKeys());
    175175
    176176    /**
     
    185185    public void startTest(ProgressMonitor monitor) {
    186186        super.startTest(monitor);
    187         relations = new MultiMap<RelationPair, OsmPrimitive>(1000);
    188         relations_nokeys = new MultiMap<List<RelationMember>, OsmPrimitive>(1000);
     187        relations = new MultiMap<>(1000);
     188        relations_nokeys = new MultiMap<>(1000);
    189189    }
    190190
     
    229229        if (testError.getCode() == SAME_RELATION) return null;
    230230        Collection<? extends OsmPrimitive> sel = testError.getPrimitives();
    231         HashSet<Relation> relFix = new HashSet<Relation>();
     231        HashSet<Relation> relFix = new HashSet<>();
    232232
    233233        for (OsmPrimitive osm : sel)
     
    263263        }
    264264
    265         Collection<Command> commands = new LinkedList<Command>();
     265        Collection<Command> commands = new LinkedList<>();
    266266
    267267        // Fix relations.
     
    292292        // We fix it only if there is no more than one relation that is relation member.
    293293        Collection<? extends OsmPrimitive> sel = testError.getPrimitives();
    294         HashSet<Relation> relations = new HashSet<Relation>();
     294        HashSet<Relation> relations = new HashSet<>();
    295295
    296296        for (OsmPrimitive osm : sel)
  • trunk/src/org/openstreetmap/josm/data/validation/tests/DuplicateWay.java

    r6494 r7005  
    107107    public void startTest(ProgressMonitor monitor) {
    108108        super.startTest(monitor);
    109         ways = new MultiMap<WayPair, OsmPrimitive>(1000);
    110         waysNoTags = new MultiMap<WayPairNoTags, OsmPrimitive>(1000);
    111         knownHashCodes = new HashSet<Integer>(1000);
     109        ways = new MultiMap<>(1000);
     110        waysNoTags = new MultiMap<>(1000);
     111        knownHashCodes = new HashSet<>(1000);
    112112    }
    113113
     
    168168            return;
    169169        List<Node> wNodes = w.getNodes();                            // The original list of nodes for this way
    170         List<Node> wNodesToUse = new ArrayList<Node>(wNodes.size()); // The list that will be considered for this test
     170        List<Node> wNodesToUse = new ArrayList<>(wNodes.size()); // The list that will be considered for this test
    171171        if (w.isClosed()) {
    172172            // In case of a closed way, build the list of lat/lon starting from the node with the lowest id
     
    192192        }
    193193        // Build the list of lat/lon
    194         List<LatLon> wLat = new ArrayList<LatLon>(wNodesToUse.size());
     194        List<LatLon> wLat = new ArrayList<>(wNodesToUse.size());
    195195        for (Node node : wNodesToUse) {
    196196            wLat.add(node.getCoor());
     
    200200            int hash = wLat.hashCode();
    201201            if (!knownHashCodes.contains(hash)) {
    202                 List<LatLon> reversedwLat = new ArrayList<LatLon>(wLat);
     202                List<LatLon> reversedwLat = new ArrayList<>(wLat);
    203203                   Collections.reverse(reversedwLat);
    204204                int reverseHash = reversedwLat.hashCode();
     
    226226    public Command fixError(TestError testError) {
    227227        Collection<? extends OsmPrimitive> sel = testError.getPrimitives();
    228         HashSet<Way> ways = new HashSet<Way>();
     228        HashSet<Way> ways = new HashSet<>();
    229229
    230230        for (OsmPrimitive osm : sel) {
     
    261261        }
    262262
    263         Collection<Command> commands = new LinkedList<Command>();
     263        Collection<Command> commands = new LinkedList<>();
    264264
    265265        // Fix relations.
     
    294294        // We fix it only if there is no more than one way that is relation member.
    295295        Collection<? extends OsmPrimitive> sel = testError.getPrimitives();
    296         HashSet<Way> ways = new HashSet<Way>();
     296        HashSet<Way> ways = new HashSet<>();
    297297
    298298        for (OsmPrimitive osm : sel) {
  • trunk/src/org/openstreetmap/josm/data/validation/tests/Highways.java

    r6937 r7005  
    111111
    112112    private void testWrongRoundabout(Way w) {
    113         Map<String, List<Way>> map = new HashMap<String, List<Way>>();
     113        Map<String, List<Way>> map = new HashMap<>();
    114114        // Count all highways (per type) connected to this roundabout, except links
    115115        // As roundabouts are closed ways, take care of not processing the first/last node twice
    116         for (Node n : new HashSet<Node>(w.getNodes())) {
     116        for (Node n : new HashSet<>(w.getNodes())) {
    117117            for (Way h : Utils.filteredCollection(n.getReferrers(), Way.class)) {
    118118                String value = h.get("highway");
     
    120120                    List<Way> list = map.get(value);
    121121                    if (list == null) {
    122                         map.put(value, list = new ArrayList<Way>());
     122                        map.put(value, list = new ArrayList<>());
    123123                    }
    124124                    list.add(h);
     
    150150        }
    151151
    152         final HashSet<OsmPrimitive> referrers = new HashSet<OsmPrimitive>();
     152        final HashSet<OsmPrimitive> referrers = new HashSet<>();
    153153        referrers.addAll(way.firstNode().getReferrers());
    154154        referrers.addAll(way.lastNode().getReferrers());
  • trunk/src/org/openstreetmap/josm/data/validation/tests/Lanes.java

    r6834 r7005  
    4141            return;
    4242        }
    43         final Set<Integer> lanesCount = new HashSet<Integer>(Utils.transform(keysForPattern, new Utils.Function<String, Integer>() {
     43        final Set<Integer> lanesCount = new HashSet<>(Utils.transform(keysForPattern, new Utils.Function<String, Integer>() {
    4444            @Override
    4545            public Integer apply(String key) {
  • trunk/src/org/openstreetmap/josm/data/validation/tests/MapCSSTagChecker.java

    r6986 r7005  
    6969    }
    7070
    71     final List<TagCheck> checks = new ArrayList<TagCheck>();
     71    final List<TagCheck> checks = new ArrayList<>();
    7272
    7373    static class TagCheck implements Predicate<OsmPrimitive> {
    7474        protected final MapCSSRule rule;
    75         protected final List<PrimitiveToTag> change = new ArrayList<PrimitiveToTag>();
    76         protected final Map<String, String> keyChange = new LinkedHashMap<String, String>();
    77         protected final List<String> alternatives = new ArrayList<String>();
    78         protected final Map<Instruction.AssignmentInstruction, Severity> errors = new HashMap<Instruction.AssignmentInstruction, Severity>();
    79         protected final Map<String, Boolean> assertions = new HashMap<String, Boolean>();
     75        protected final List<PrimitiveToTag> change = new ArrayList<>();
     76        protected final Map<String, String> keyChange = new LinkedHashMap<>();
     77        protected final List<String> alternatives = new ArrayList<>();
     78        protected final Map<Instruction.AssignmentInstruction, Severity> errors = new HashMap<>();
     79        protected final Map<String, Boolean> assertions = new HashMap<>();
    8080
    8181        TagCheck(MapCSSRule rule) {
     
    180180            // Ignore "meta" rule(s) from external rules of JOSM wiki
    181181            removeMetaRules(source);
    182             return new ArrayList<TagCheck>(Utils.transform(source.rules, new Utils.Function<MapCSSRule, TagCheck>() {
     182            return new ArrayList<>(Utils.transform(source.rules, new Utils.Function<MapCSSRule, TagCheck>() {
    183183                @Override
    184184                public TagCheck apply(MapCSSRule x) {
     
    297297            }
    298298            final Selector matchingSelector = whichSelectorMatchesPrimitive(p);
    299             Collection<Command> cmds = new LinkedList<Command>();
     299            Collection<Command> cmds = new LinkedList<>();
    300300            for (PrimitiveToTag toTag : change) {
    301301                final Tag tag = toTag.apply(p);
     
    416416     */
    417417    public Collection<TestError> getErrorsForPrimitive(OsmPrimitive p, boolean includeOtherSeverity) {
    418         final ArrayList<TestError> r = new ArrayList<TestError>();
     418        final ArrayList<TestError> r = new ArrayList<>();
    419419        final Environment env = new Environment(p, new MultiCascade(), Environment.DEFAULT_LAYER, null);
    420420        for (TagCheck check : checks) {
  • trunk/src/org/openstreetmap/josm/data/validation/tests/MultipolygonTest.java

    r6731 r7005  
    5757    private static ElemStyles styles;
    5858
    59     private final List<List<Node>> nonClosedWays = new ArrayList<List<Node>>();
    60     private final Set<String> keysCheckedByAnotherTest = new HashSet<String>();
     59    private final List<List<Node>> nonClosedWays = new ArrayList<>();
     60    private final Set<String> keysCheckedByAnotherTest = new HashSet<>();
    6161
    6262    /**
     
    9292
    9393    private List<List<Node>> joinWays(Collection<Way> ways) {
    94         List<List<Node>> result = new ArrayList<List<Node>>();
    95         List<Way> waysToJoin = new ArrayList<Way>();
     94        List<List<Node>> result = new ArrayList<>();
     95        List<Way> waysToJoin = new ArrayList<>();
    9696        for (Way way : ways) {
    9797            if (way.isClosed()) {
     
    123123
    124124    private List<GeneralPath> createPolygons(List<List<Node>> joinedWays) {
    125         List<GeneralPath> result = new ArrayList<GeneralPath>();
     125        List<GeneralPath> result = new ArrayList<>();
    126126        for (List<Node> way : joinedWays) {
    127127            result.add(createPath(way));
     
    229229
    230230                        if (areaInner != null && area.equals(areaInner)) {
    231                             List<OsmPrimitive> l = new ArrayList<OsmPrimitive>();
     231                            List<OsmPrimitive> l = new ArrayList<>();
    232232                            l.add(r);
    233233                            l.add(wInner);
     
    240240                            AreaElemStyle areaOuter = ElemStyles.getAreaElemStyle(wOuter, false);
    241241                            if (areaOuter != null && !area.equals(areaOuter)) {
    242                                 List<OsmPrimitive> l = new ArrayList<OsmPrimitive>();
     242                                List<OsmPrimitive> l = new ArrayList<>();
    243243                                l.add(r);
    244244                                l.add(wOuter);
     
    251251            }
    252252
    253             List<Node> openNodes = new LinkedList<Node>();
     253            List<Node> openNodes = new LinkedList<>();
    254254            for (List<Node> w : nonClosedWays) {
    255255                if (w.size()<1) continue;
     
    258258            }
    259259            if (!openNodes.isEmpty()) {
    260                 List<OsmPrimitive> primitives = new LinkedList<OsmPrimitive>();
     260                List<OsmPrimitive> primitives = new LinkedList<>();
    261261                primitives.add(r);
    262262                primitives.addAll(openNodes);
     
    282282                }
    283283                if (outside || crossing) {
    284                     List<List<Node>> highlights = new ArrayList<List<Node>>();
     284                    List<List<Node>> highlights = new ArrayList<>();
    285285                    highlights.add(pdInner);
    286286                    if (outside) {
     
    319319                }
    320320            }
    321             List<OsmPrimitive> newPrimitives = new ArrayList<OsmPrimitive>(primitives);
     321            List<OsmPrimitive> newPrimitives = new ArrayList<>(primitives);
    322322            newPrimitives.add(0, r);
    323323            error.setPrimitives(newPrimitives);
  • trunk/src/org/openstreetmap/josm/data/validation/tests/NameMismatch.java

    r6823 r7005  
    44import static org.openstreetmap.josm.tools.I18n.tr;
    55
    6 import java.util.Collection;
    76import java.util.HashSet;
    87import java.util.Map.Entry;
     
    6160    @Override
    6261    public void check(OsmPrimitive p) {
    63         HashSet<String> names = new HashSet<String>();
     62        HashSet<String> names = new HashSet<>();
    6463
    6564        for (Entry<String, String> entry : p.getKeys().entrySet()) {
  • trunk/src/org/openstreetmap/josm/data/validation/tests/OpeningHourTest.java

    r7004 r7005  
    191191            return Collections.emptyList();
    192192        }
    193         final List<OpeningHoursTestError> errors = new ArrayList<OpeningHoursTestError>();
     193        final List<OpeningHoursTestError> errors = new ArrayList<>();
    194194        try {
    195195            final Object r = parse(value, mode);
  • trunk/src/org/openstreetmap/josm/data/validation/tests/OverlappingWays.java

    r6940 r7005  
    6464    public void startTest(ProgressMonitor monitor)  {
    6565        super.startTest(monitor);
    66         nodePairs = new MultiMap<Pair<Node,Node>, WaySegment>(1000);
     66        nodePairs = new MultiMap<>(1000);
    6767    }
    6868
     
    7878    @Override
    7979    public void endTest() {
    80         Map<List<Way>, Set<WaySegment>> seenWays = new HashMap<List<Way>, Set<WaySegment>>(500);
    81 
    82         Collection<TestError> preliminaryErrors = new ArrayList<TestError>();
     80        Map<List<Way>, Set<WaySegment>> seenWays = new HashMap<>(500);
     81
     82        Collection<TestError> preliminaryErrors = new ArrayList<>();
    8383        for (Set<WaySegment> duplicated : nodePairs.values()) {
    8484            int ways = duplicated.size();
    8585
    8686            if (ways > 1) {
    87                 List<OsmPrimitive> prims = new ArrayList<OsmPrimitive>();
    88                 List<Way> currentWays = new ArrayList<Way>();
     87                List<OsmPrimitive> prims = new ArrayList<>();
     88                List<Way> currentWays = new ArrayList<>();
    8989                Collection<WaySegment> highlight;
    9090                int highway = 0;
     
    178178    protected static Set<WaySegment> checkDuplicateWaySegment(Way w) {
    179179        // test for ticket #4959
    180         Set<WaySegment> segments = new TreeSet<WaySegment>(new Comparator<WaySegment>() {
     180        Set<WaySegment> segments = new TreeSet<>(new Comparator<WaySegment>() {
    181181            @Override
    182182            public int compare(WaySegment o1, WaySegment o2) {
     
    190190            }
    191191        });
    192         final Set<WaySegment> duplicateWaySegments = new HashSet<WaySegment>();
     192        final Set<WaySegment> duplicateWaySegments = new HashSet<>();
    193193
    194194        for (int i = 0; i < w.getNodesCount() - 1; i++) {
     
    224224                continue;
    225225            }
    226             nodePairs.put(Pair.sort(new Pair<Node,Node>(lastN, n)),
     226            nodePairs.put(Pair.sort(new Pair<>(lastN, n)),
    227227                    new WaySegment(w, i));
    228228            lastN = n;
  • trunk/src/org/openstreetmap/josm/data/validation/tests/PowerLines.java

    r6903 r7005  
    4545    public static final Collection<String> POWER_ALLOWED_TAGS = Arrays.asList("switch", "transformer", "busbar", "generator");
    4646
    47     private final Map<Way, String> towerPoleTagMap = new HashMap<Way, String>();
    48 
    49     private final List<PowerLineError> potentialErrors = new ArrayList<PowerLineError>();
    50 
    51     private final List<OsmPrimitive> powerStations = new ArrayList<OsmPrimitive>();
     47    private final Map<Way, String> towerPoleTagMap = new HashMap<>();
     48
     49    private final List<PowerLineError> potentialErrors = new ArrayList<>();
     50
     51    private final List<OsmPrimitive> powerStations = new ArrayList<>();
    5252
    5353    /**
     
    118118    protected final boolean isInPowerStation(Node n) {
    119119        for (OsmPrimitive station : powerStations) {
    120             List<List<Node>> nodesLists = new ArrayList<List<Node>>();
     120            List<List<Node>> nodesLists = new ArrayList<>();
    121121            if (station instanceof Way) {
    122122                nodesLists.add(((Way)station).getNodes());
  • trunk/src/org/openstreetmap/josm/data/validation/tests/RelationChecker.java

    r6863 r7005  
    6565    }
    6666
    67     private static Collection<TaggingPreset> relationpresets = new LinkedList<TaggingPreset>();
     67    private static Collection<TaggingPreset> relationpresets = new LinkedList<>();
    6868
    6969    /**
     
    8787    private static class RoleInfo {
    8888        private int total = 0;
    89         private Collection<Node> nodes = new LinkedList<Node>();
    90         private Collection<Way> ways = new LinkedList<Way>();
    91         private Collection<Way> openways = new LinkedList<Way>();
    92         private Collection<Relation> relations = new LinkedList<Relation>();
     89        private Collection<Node> nodes = new LinkedList<>();
     90        private Collection<Way> ways = new LinkedList<>();
     91        private Collection<Way> openways = new LinkedList<>();
     92        private Collection<Relation> relations = new LinkedList<>();
    9393    }
    9494
     
    9696    @Override
    9797    public void visit(Relation n) {
    98         LinkedList<Role> allroles = new LinkedList<Role>();
     98        LinkedList<Role> allroles = new LinkedList<>();
    9999        for (TaggingPreset p : relationpresets) {
    100100            boolean matches = true;
     
    124124                    RELATION_UNKNOWN, n) );
    125125        } else {
    126             HashMap<String,RoleInfo> map = new HashMap<String, RoleInfo>();
     126            HashMap<String,RoleInfo> map = new HashMap<>();
    127127            for (RelationMember m : n.getMembers()) {
    128128                String s = "";
     
    152152                        RELATION_EMPTY, n) );
    153153            } else {
    154                 LinkedList<String> done = new LinkedList<String>();
     154                LinkedList<String> done = new LinkedList<>();
    155155                for (Role r : allroles) {
    156156                    done.add(r.key);
     
    180180                    if (ri != null) {
    181181                        if (r.types != null) {
    182                             Set<OsmPrimitive> wrongTypes = new HashSet<OsmPrimitive>();
     182                            Set<OsmPrimitive> wrongTypes = new HashSet<>();
    183183                            if (!r.types.contains(TaggingPresetType.WAY)) {
    184184                                wrongTypes.addAll(r.types.contains(TaggingPresetType.CLOSEDWAY) ? ri.openways : ri.ways);
     
    192192                            if (!wrongTypes.isEmpty()) {
    193193                                String s = marktr("Member for role {0} of wrong type");
    194                                 LinkedList<OsmPrimitive> highlight = new LinkedList<OsmPrimitive>(wrongTypes);
     194                                LinkedList<OsmPrimitive> highlight = new LinkedList<>(wrongTypes);
    195195                                highlight.addFirst(n);
    196196                                errors.add(new TestError(this, Severity.WARNING, ROLE_VERIF_PROBLEM_MSG,
     
    200200                        }
    201201                        if (r.memberExpression != null) {
    202                             Set<OsmPrimitive> notMatching = new HashSet<OsmPrimitive>();
     202                            Set<OsmPrimitive> notMatching = new HashSet<>();
    203203                            for (Collection<OsmPrimitive> c : Arrays.asList(new Collection[]{ri.nodes, ri.ways, ri.relations})) {
    204204                                for (OsmPrimitive p : c) {
     
    210210                            if (!notMatching.isEmpty()) {
    211211                                String s = marktr("Member for role ''{0}'' does not match ''{1}''");
    212                                 LinkedList<OsmPrimitive> highlight = new LinkedList<OsmPrimitive>(notMatching);
     212                                LinkedList<OsmPrimitive> highlight = new LinkedList<>(notMatching);
    213213                                highlight.addFirst(n);
    214214                                errors.add(new TestError(this, Severity.WARNING, ROLE_VERIF_PROBLEM_MSG,
  • trunk/src/org/openstreetmap/josm/data/validation/tests/SelfIntersectingWay.java

    r6241 r7005  
    3030
    3131    @Override public void visit(Way w) {
    32         HashSet<Node> nodes = new HashSet<Node>();
     32        HashSet<Node> nodes = new HashSet<>();
    3333
    3434        for (int i = 1; i < w.getNodesCount() - 1; i++) {
  • trunk/src/org/openstreetmap/josm/data/validation/tests/SimilarNamedWays.java

    r6240 r7005  
    4646    public void startTest(ProgressMonitor monitor) {
    4747        super.startTest(monitor);
    48         cellWays = new HashMap<Point2D,List<Way>>(1000);
    49         errorWays = new MultiMap<Way, Way>();
     48        cellWays = new HashMap<>(1000);
     49        errorWays = new MultiMap<>();
    5050    }
    5151
     
    8080                int levenshteinDistance = getLevenshteinDistance(name, name2);
    8181                if (0 < levenshteinDistance && levenshteinDistance <= 2) {
    82                     List<OsmPrimitive> primitives = new ArrayList<OsmPrimitive>(2);
     82                    List<OsmPrimitive> primitives = new ArrayList<>(2);
    8383                    primitives.add(w);
    8484                    primitives.add(w2);
  • trunk/src/org/openstreetmap/josm/data/validation/tests/TagChecker.java

    r7004 r7005  
    7575    protected static MultiMap<String, String> presetsValueData;
    7676    /** The TagChecker data */
    77     protected static final List<CheckerData> checkerData = new ArrayList<CheckerData>();
    78     protected static final List<String> ignoreDataStartsWith = new ArrayList<String>();
    79     protected static final List<String> ignoreDataEquals = new ArrayList<String>();
    80     protected static final List<String> ignoreDataEndsWith = new ArrayList<String>();
    81     protected static final List<IgnoreKeyPair> ignoreDataKeyPair = new ArrayList<IgnoreKeyPair>();
     77    protected static final List<CheckerData> checkerData = new ArrayList<>();
     78    protected static final List<String> ignoreDataStartsWith = new ArrayList<>();
     79    protected static final List<String> ignoreDataEquals = new ArrayList<>();
     80    protected static final List<String> ignoreDataEndsWith = new ArrayList<>();
     81    protected static final List<IgnoreKeyPair> ignoreDataKeyPair = new ArrayList<>();
    8282
    8383    /** The preferences prefix */
     
    161161        ignoreDataKeyPair.clear();
    162162
    163         spellCheckKeyData = new HashMap<String, String>();
     163        spellCheckKeyData = new HashMap<>();
    164164       
    165165        String errorSources = "";
     
    258258        Collection<TaggingPreset> presets = TaggingPresetPreference.taggingPresets;
    259259        if (presets != null) {
    260             presetsValueData = new MultiMap<String, String>();
     260            presetsValueData = new MultiMap<>();
    261261            for (String a : OsmPrimitive.getUninterestingKeys()) {
    262262                presetsValueData.putVoid(a);
     
    316316    public void check(OsmPrimitive p) {
    317317        // Just a collection to know if a primitive has been already marked with error
    318         MultiMap<OsmPrimitive, String> withErrors = new MultiMap<OsmPrimitive, String>();
     318        MultiMap<OsmPrimitive, String> withErrors = new MultiMap<>();
    319319
    320320        if (checkComplex) {
     
    550550    @Override
    551551    public Command fixError(TestError testError) {
    552         List<Command> commands = new ArrayList<Command>(50);
     552        List<Command> commands = new ArrayList<>(50);
    553553
    554554        Collection<? extends OsmPrimitive> primitives = testError.getPrimitives();
     
    607607    protected static class CheckerData {
    608608        private String description;
    609         protected List<CheckerElement> data = new ArrayList<CheckerElement>();
     609        protected List<CheckerElement> data = new ArrayList<>();
    610610        private OsmPrimitiveType type;
    611611        private int code;
  • trunk/src/org/openstreetmap/josm/data/validation/tests/TurnrestrictionTest.java

    r6316 r7005  
    5454        Way fromWay = null;
    5555        Way toWay = null;
    56         List<OsmPrimitive> via = new ArrayList<OsmPrimitive>();
     56        List<OsmPrimitive> via = new ArrayList<>();
    5757
    5858        boolean morefrom = false;
     
    6666                return;
    6767
    68             List<OsmPrimitive> l = new ArrayList<OsmPrimitive>();
     68            List<OsmPrimitive> l = new ArrayList<>();
    6969            l.add(r);
    7070            l.add(m.getMember());
  • trunk/src/org/openstreetmap/josm/data/validation/tests/UnclosedWays.java

    r6916 r7005  
    156156     */
    157157    public Set<String> getCheckedKeys() {
    158         Set<String> keys = new HashSet<String>();
     158        Set<String> keys = new HashSet<>();
    159159        for (UnclosedWaysCheck c : checks) {
    160160            keys.add(c.key);
  • trunk/src/org/openstreetmap/josm/data/validation/tests/UnconnectedWays.java

    r6830 r7005  
    157157    public void startTest(ProgressMonitor monitor) {
    158158        super.startTest(monitor);
    159         ways = new HashSet<MyWaySegment>();
    160         endnodes = new QuadBuckets<Node>();
    161         endnodes_highway = new QuadBuckets<Node>();
    162         middlenodes = new QuadBuckets<Node>();
    163         othernodes = new HashSet<Node>();
     159        ways = new HashSet<>();
     160        endnodes = new QuadBuckets<>();
     161        endnodes_highway = new QuadBuckets<>();
     162        middlenodes = new QuadBuckets<>();
     163        othernodes = new HashSet<>();
    164164        mindist = Main.pref.getDouble(PREFIX + ".node_way_distance", 10.0);
    165165        minmiddledist = Main.pref.getDouble(PREFIX + ".way_way_distance", 0.0);
     
    168168
    169169    protected Map<Node, Way> getWayEndNodesNearOtherHighway() {
    170         Map<Node, Way> map = new HashMap<Node, Way>();
     170        Map<Node, Way> map = new HashMap<>();
    171171        for (int iter = 0; iter < 1; iter++) {
    172172            for (MyWaySegment s : ways) {
     
    199199
    200200    protected Map<Node, Way> getWayEndNodesNearOtherWay() {
    201         Map<Node, Way> map = new HashMap<Node, Way>();
     201        Map<Node, Way> map = new HashMap<>();
    202202        for (MyWaySegment s : ways) {
    203203            if (isCanceled()) {
     
    220220
    221221    protected Map<Node, Way> getWayNodesNearOtherWay() {
    222         Map<Node, Way> map = new HashMap<Node, Way>();
     222        Map<Node, Way> map = new HashMap<>();
    223223        for (MyWaySegment s : ways) {
    224224            if (isCanceled()) {
     
    240240
    241241    protected Map<Node, Way> getConnectedWayEndNodesNearOtherWay() {
    242         Map<Node, Way> map = new HashMap<Node, Way>();
     242        Map<Node, Way> map = new HashMap<>();
    243243        for (MyWaySegment s : ways) {
    244244            if (isCanceled()) {
     
    348348            LatLon topLeft  = new LatLon(y2+fudge, x1-fudge);
    349349            LatLon botRight = new LatLon(y1-fudge, x2+fudge);
    350             List<LatLon> ret = new ArrayList<LatLon>(2);
     350            List<LatLon> ret = new ArrayList<>(2);
    351351            ret.add(topLeft);
    352352            ret.add(botRight);
     
    368368                    // the nodes that are not in the smaller
    369369                    // area, but keep the old larger cache.
    370                     Set<Node> trimmed = new HashSet<Node>(nearbyNodeCache);
    371                     Set<Node> initial = new HashSet<Node>(nearbyNodeCache);
     370                    Set<Node> trimmed = new HashSet<>(nearbyNodeCache);
     371                    Set<Node> initial = new HashSet<>(nearbyNodeCache);
    372372                    for (Node n : initial) {
    373373                        if (!nearby(n, dist)) {
     
    400400                // allocating the hash set
    401401                if (nearbyNodeCache == null) {
    402                     nearbyNodeCache = new HashSet<Node>();
     402                    nearbyNodeCache = new HashSet<>();
    403403                }
    404404                nearbyNodeCache.add(n);
     
    413413
    414414    List<MyWaySegment> getWaySegments(Way w) {
    415         List<MyWaySegment> ret = new ArrayList<MyWaySegment>();
     415        List<MyWaySegment> ret = new ArrayList<>();
    416416        if (!w.isUsable()
    417417                || w.hasKey("barrier")
  • trunk/src/org/openstreetmap/josm/data/validation/tests/UntaggedWay.java

    r6494 r7005  
    4242
    4343    /** Ways that must have a name */
    44     public static final Set<String> NAMED_WAYS = new HashSet<String>();
     44    public static final Set<String> NAMED_WAYS = new HashSet<>();
    4545    static {
    4646        NAMED_WAYS.add( "motorway" );
     
    5454
    5555    /** Whitelist of roles allowed to reference an untagged way */
    56     public static final Set<String> WHITELIST = new HashSet<String>();
     56    public static final Set<String> WHITELIST = new HashSet<>();
    5757    static {
    5858        WHITELIST.add( "outer" );
     
    119119    public void startTest(ProgressMonitor monitor) {
    120120        super.startTest(monitor);
    121         waysUsedInRelations = new HashSet<Way>();
     121        waysUsedInRelations = new HashSet<>();
    122122        for (Relation r : Main.main.getCurrentDataSet().getRelations()) {
    123123            if (r.isUsable()) {
  • trunk/src/org/openstreetmap/josm/data/validation/util/AggregatePrimitivesVisitor.java

    r6010 r7005  
    2121public class AggregatePrimitivesVisitor extends AbstractVisitor {
    2222    /** Aggregated data */
    23     final Collection<OsmPrimitive> aggregatedData = new HashSet<OsmPrimitive>();
     23    final Collection<OsmPrimitive> aggregatedData = new HashSet<>();
    2424
    2525    /**
  • trunk/src/org/openstreetmap/josm/data/validation/util/Entities.java

    r6920 r7005  
    386386                        if(mapNameToValue == null)
    387387                        {
    388                             mapNameToValue = new HashMap<String, String>();
     388                            mapNameToValue = new HashMap<>();
    389389                            for (String[] pair : ARRAY)
    390390                                mapNameToValue.put(pair[0], pair[1]);
  • trunk/src/org/openstreetmap/josm/data/validation/util/ValUtil.java

    r6869 r7005  
    4040        Node n2 = w.getNode(w.getNodesCount() - 1);
    4141
    42         List<List<Way>> cells = new ArrayList<List<Way>>(2);
    43         Set<Point2D> cellNodes = new HashSet<Point2D>();
     42        List<List<Way>> cells = new ArrayList<>(2);
     43        Set<Point2D> cellNodes = new HashSet<>();
    4444        Point2D cell;
    4545
     
    5555        List<Way> ways = cellWays.get(cell);
    5656        if (ways == null) {
    57             ways = new ArrayList<Way>();
     57            ways = new ArrayList<>();
    5858            cellWays.put(cell, ways);
    5959        }
     
    6666            ways = cellWays.get( cell );
    6767            if (ways == null) {
    68                 ways = new ArrayList<Way>();
     68                ways = new ArrayList<>();
    6969                cellWays.put(cell, ways);
    7070            }
     
    8484            ways = cellWays.get(cell);
    8585            if (ways == null) {
    86                 ways = new ArrayList<Way>();
     86                ways = new ArrayList<>();
    8787                cellWays.put(cell, ways);
    8888            }
     
    9696            ways = cellWays.get(cell);
    9797            if (ways == null) {
    98                 ways = new ArrayList<Way>();
     98                ways = new ArrayList<>();
    9999                cellWays.put(cell, ways);
    100100            }
     
    134134        CheckParameterUtil.ensureParameterNotNull(en1, "en1");
    135135        CheckParameterUtil.ensureParameterNotNull(en2, "en2");
    136         List<Point2D> cells = new ArrayList<Point2D>();
     136        List<Point2D> cells = new ArrayList<>();
    137137        double x0 = en1.east() * gridDetail;
    138138        double x1 = en2.east() * gridDetail;
Note: See TracChangeset for help on using the changeset viewer.