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
Files:
96 edited

Legend:

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

    r6890 r7005  
    4444     */
    4545    public APIDataSet() {
    46         toAdd = new LinkedList<OsmPrimitive>();
    47         toUpdate = new LinkedList<OsmPrimitive>();
    48         toDelete = new LinkedList<OsmPrimitive>();
     46        toAdd = new LinkedList<>();
     47        toUpdate = new LinkedList<>();
     48        toDelete = new LinkedList<>();
    4949    }
    5050
     
    122122    public boolean participatesInConflict(ConflictCollection conflicts) {
    123123        if (conflicts == null || conflicts.isEmpty()) return false;
    124         Set<PrimitiveId> idsParticipatingInConflicts = new HashSet<PrimitiveId>();
     124        Set<PrimitiveId> idsParticipatingInConflicts = new HashSet<>();
    125125        for (OsmPrimitive p: conflicts.getMyConflictParties()) {
    126126            idsParticipatingInConflicts.add(p.getPrimitiveId());
     
    190190     */
    191191    public List<OsmPrimitive> getPrimitives() {
    192         LinkedList<OsmPrimitive> ret = new LinkedList<OsmPrimitive>();
     192        LinkedList<OsmPrimitive> ret = new LinkedList<>();
    193193        ret.addAll(toAdd);
    194194        ret.addAll(toUpdate);
     
    223223     */
    224224    public void adjustRelationUploadOrder() throws CyclicUploadDependencyException{
    225         LinkedList<OsmPrimitive> newToAdd = new LinkedList<OsmPrimitive>();
     225        LinkedList<OsmPrimitive> newToAdd = new LinkedList<>();
    226226        newToAdd.addAll(Utils.filteredCollection(toAdd, Node.class));
    227227        newToAdd.addAll(Utils.filteredCollection(toAdd, Way.class));
    228228
    229         List<Relation> relationsToAdd = new ArrayList<Relation>(Utils.filteredCollection(toAdd, Relation.class));
     229        List<Relation> relationsToAdd = new ArrayList<>(Utils.filteredCollection(toAdd, Relation.class));
    230230        List<Relation> noProblemRelations = filterRelationsNotReferringToNewRelations(relationsToAdd);
    231231        newToAdd.addAll(noProblemRelations);
     
    236236        toAdd = newToAdd;
    237237
    238         LinkedList<OsmPrimitive> newToDelete = new LinkedList<OsmPrimitive>();
     238        LinkedList<OsmPrimitive> newToDelete = new LinkedList<>();
    239239        graph = new RelationUploadDependencyGraph(Utils.filteredCollection(toDelete, Relation.class), false);
    240240        newToDelete.addAll(graph.computeUploadOrder());
     
    253253     */
    254254    protected List<Relation> filterRelationsNotReferringToNewRelations(Collection<Relation> relations) {
    255         List<Relation> ret = new LinkedList<Relation>();
     255        List<Relation> ret = new LinkedList<>();
    256256        for (Relation relation: relations) {
    257257            boolean refersToNewRelation = false;
     
    275275     */
    276276    private static class RelationUploadDependencyGraph {
    277         private Map<Relation, Set<Relation>> children = new HashMap<Relation, Set<Relation>>();
     277        private Map<Relation, Set<Relation>> children = new HashMap<>();
    278278        private Collection<Relation> relations;
    279         private Set<Relation> visited = new HashSet<Relation>();
     279        private Set<Relation> visited = new HashSet<>();
    280280        private List<Relation> uploadOrder;
    281281        private final boolean newOrUndeleted;
     
    287287
    288288        public final void build(Collection<Relation> relations) {
    289             this.relations = new HashSet<Relation>();
     289            this.relations = new HashSet<>();
    290290            for(Relation relation: relations) {
    291291                if (newOrUndeleted ? !relation.isNewOrUndeleted() : !relation.isDeleted()) {
     
    304304            Set<Relation> p = children.get(relation);
    305305            if (p == null) {
    306                 p = new HashSet<Relation>();
     306                p = new HashSet<>();
    307307                children.put(relation, p);
    308308            }
     
    331331
    332332        public List<Relation> computeUploadOrder() throws CyclicUploadDependencyException {
    333             visited = new HashSet<Relation>();
    334             uploadOrder = new LinkedList<Relation>();
    335             Stack<Relation> path = new Stack<Relation>();
     333            visited = new HashSet<>();
     334            uploadOrder = new LinkedList<>();
     335            Stack<Relation> path = new Stack<>();
    336336            for (Relation relation: relations) {
    337337                visit(path, relation);
    338338            }
    339             List<Relation> ret = new ArrayList<Relation>(relations);
     339            List<Relation> ret = new ArrayList<>(relations);
    340340            Collections.sort(
    341341                    ret,
  • trunk/src/org/openstreetmap/josm/data/AutosaveTask.java

    r6995 r7005  
    7676        String layerName;
    7777        String layerFileName;
    78         final Deque<File> backupFiles = new LinkedList<File>();
     78        final Deque<File> backupFiles = new LinkedList<>();
    7979    }
    8080
    8181    private final DataSetListenerAdapter datasetAdapter = new DataSetListenerAdapter(this);
    82     private final Set<DataSet> changedDatasets = new HashSet<DataSet>();
    83     private final List<AutosaveLayerInfo> layersInfo = new ArrayList<AutosaveLayerInfo>();
     82    private final Set<DataSet> changedDatasets = new HashSet<>();
     83    private final List<AutosaveLayerInfo> layersInfo = new ArrayList<>();
    8484    private Timer timer;
    8585    private final Object layersLock = new Object();
    86     private final Deque<File> deletedLayers = new LinkedList<File>();
     86    private final Deque<File> deletedLayers = new LinkedList<>();
    8787
    8888    private final File autosaveDir = new File(Main.pref.getPreferencesDir() + AUTOSAVE_DIR);
     
    300300     */
    301301    public List<File> getUnsavedLayersFiles() {
    302         List<File> result = new ArrayList<File>();
     302        List<File> result = new ArrayList<>();
    303303        File[] files = autosaveDir.listFiles(OsmImporter.FILE_FILTER);
    304304        if (files == null)
  • trunk/src/org/openstreetmap/josm/data/CustomConfigurator.java

    r6987 r7005  
    201201     */
    202202    public static void exportPreferencesKeysToFile(String filename, boolean append, String... keys) {
    203         HashSet<String> keySet = new HashSet<String>();
     203        HashSet<String> keySet = new HashSet<>();
    204204        Collections.addAll(keySet, keys);
    205205        exportPreferencesKeysToFile(filename, append, keySet);
     
    215215     */
    216216    public static void exportPreferencesKeysByPatternToFile(String fileName, boolean append, String pattern) {
    217         List<String> keySet = new ArrayList<String>();
     217        List<String> keySet = new ArrayList<>();
    218218        Map<String, Setting> allSettings = Main.pref.getAllSettings();
    219219        for (String key: allSettings.keySet()) {
     
    317317
    318318    public static void pluginOperation(String install, String uninstall, String delete)  {
    319         final List<String> installList = new ArrayList<String>();
    320         final List<String> removeList = new ArrayList<String>();
    321         final List<String> deleteList = new ArrayList<String>();
     319        final List<String> installList = new ArrayList<>();
     320        final List<String> removeList = new ArrayList<>();
     321        final List<String> deleteList = new ArrayList<>();
    322322        Collections.addAll(installList, install.toLowerCase().split(";"));
    323323        Collections.addAll(removeList, uninstall.toLowerCase().split(";"));
     
    351351                    public void run() {
    352352                        List<PluginInformation> availablePlugins = task.getAvailablePlugins();
    353                         List<PluginInformation> toInstallPlugins = new ArrayList<PluginInformation>();
    354                         List<PluginInformation> toRemovePlugins = new ArrayList<PluginInformation>();
    355                         List<PluginInformation> toDeletePlugins = new ArrayList<PluginInformation>();
     353                        List<PluginInformation> toInstallPlugins = new ArrayList<>();
     354                        List<PluginInformation> toRemovePlugins = new ArrayList<>();
     355                        List<PluginInformation> toDeletePlugins = new ArrayList<>();
    356356                        for (PluginInformation pi: availablePlugins) {
    357357                            String name = pi.name.toLowerCase();
     
    364364                            Main.worker.submit(pluginDownloadTask);
    365365                        }
    366                         Collection<String> pls = new ArrayList<String>(Main.pref.getCollection("plugins"));
     366                        Collection<String> pls = new ArrayList<>(Main.pref.getCollection("plugins"));
    367367                        for (PluginInformation pi: toInstallPlugins) {
    368368                            if (!pls.contains(pi.name)) {
     
    415415
    416416        Preferences mainPrefs;
    417         Map<String,Element> tasksMap = new HashMap<String,Element>();
     417        Map<String,Element> tasksMap = new HashMap<>();
    418418
    419419        private boolean lastV; // last If condition result
     
    888888        }
    889889        if (existing != null)
    890             return new ArrayList<String>(existing.getValue());
     890            return new ArrayList<>(existing.getValue());
    891891        else
    892             return defaults.getValue() == null ? null : new ArrayList<String>(defaults.getValue());
     892            return defaults.getValue() == null ? null : new ArrayList<>(defaults.getValue());
    893893    }
    894894
     
    917917
    918918        if (existing != null)
    919             return new ArrayList<Map<String, String>>(existing.getValue());
     919            return new ArrayList<>(existing.getValue());
    920920        else
    921             return defaults.getValue() == null ? null : new ArrayList<Map<String, String>>(defaults.getValue());
     921            return defaults.getValue() == null ? null : new ArrayList<>(defaults.getValue());
    922922    }
    923923
     
    10031003        tmpPref.settingsMap.clear();
    10041004
    1005         Map<String, Setting> tmp = new HashMap<String, Setting>();
     1005        Map<String, Setting> tmp = new HashMap<>();
    10061006        for (Entry<String, String> e : stringMap.entrySet()) {
    10071007            tmp.put(e.getKey(), new StringSetting(e.getValue()));
     
    10331033     */
    10341034    public static void loadPrefsToJS(ScriptEngine engine, Preferences tmpPref, String whereToPutInJS, boolean includeDefaults) throws ScriptException {
    1035         Map<String, String> stringMap =  new TreeMap<String, String>();
    1036         Map<String, List<String>> listMap = new TreeMap<String, List<String>>();
    1037         Map<String, List<List<String>>> listlistMap = new TreeMap<String, List<List<String>>>();
    1038         Map<String, List<Map<String, String>>> listmapMap = new TreeMap<String, List<Map<String, String>>>();
     1035        Map<String, String> stringMap =  new TreeMap<>();
     1036        Map<String, List<String>> listMap = new TreeMap<>();
     1037        Map<String, List<List<String>>> listlistMap = new TreeMap<>();
     1038        Map<String, List<Map<String, String>>> listmapMap = new TreeMap<>();
    10391039
    10401040        if (includeDefaults) {
  • trunk/src/org/openstreetmap/josm/data/Preferences.java

    r7004 r7005  
    9393     * must not have a null value.
    9494     */
    95     protected final SortedMap<String, Setting> settingsMap = new TreeMap<String, Setting>();
     95    protected final SortedMap<String, Setting> settingsMap = new TreeMap<>();
    9696    /**
    9797     * Map the setting name to the default value of the setting.
     
    9999     * setting objects can be null.
    100100     */
    101     protected final SortedMap<String, Setting> defaultsMap = new TreeMap<String, Setting>();
     101    protected final SortedMap<String, Setting> defaultsMap = new TreeMap<>();
    102102    // maps color keys to human readable color name
    103     protected final SortedMap<String, String> colornames = new TreeMap<String, String>();
     103    protected final SortedMap<String, String> colornames = new TreeMap<>();
    104104
    105105    /**
     
    219219         */
    220220        public static ListSetting create(Collection<String> value) {
    221             return new ListSetting(value == null ? null : Collections.unmodifiableList(new ArrayList<String>(value)));
     221            return new ListSetting(value == null ? null : Collections.unmodifiableList(new ArrayList<>(value)));
    222222        }
    223223        @Override public boolean equalVal(List<String> otherVal) {
     
    276276        public static ListListSetting create(Collection<Collection<String>> value) {
    277277            if (value != null) {
    278                 List<List<String>> valueList = new ArrayList<List<String>>(value.size());
     278                List<List<String>> valueList = new ArrayList<>(value.size());
    279279                for (Collection<String> lst : value) {
    280                     valueList.add(new ArrayList<String>(lst));
     280                    valueList.add(new ArrayList<>(lst));
    281281                }
    282282                return new ListListSetting(valueList);
     
    298298            if (value == null) return new ListListSetting(null);
    299299
    300             List<List<String>> copy = new ArrayList<List<String>>(value.size());
     300            List<List<String>> copy = new ArrayList<>(value.size());
    301301            for (Collection<String> lst : value) {
    302                 List<String> lstCopy = new ArrayList<String>(lst);
     302                List<String> lstCopy = new ArrayList<>(lst);
    303303                copy.add(Collections.unmodifiableList(lstCopy));
    304304            }
     
    359359        @Override public MapListSetting copy() {
    360360            if (value == null) return new MapListSetting(null);
    361             List<Map<String, String>> copy = new ArrayList<Map<String, String>>(value.size());
     361            List<Map<String, String>> copy = new ArrayList<>(value.size());
    362362            for (Map<String, String> map : value) {
    363                 Map<String, String> mapCopy = new LinkedHashMap<String,String>(map);
     363                Map<String, String> mapCopy = new LinkedHashMap<>(map);
    364364                copy.add(Collections.unmodifiableMap(mapCopy));
    365365            }
     
    435435    }
    436436
    437     private final CopyOnWriteArrayList<PreferenceChangedListener> listeners = new CopyOnWriteArrayList<PreferenceChangedListener>();
     437    private final CopyOnWriteArrayList<PreferenceChangedListener> listeners = new CopyOnWriteArrayList<>();
    438438
    439439    public void addPreferenceChangeListener(PreferenceChangedListener listener) {
     
    541541     */
    542542    public Collection<String> getAllPossiblePreferenceDirs() {
    543         LinkedList<String> locations = new LinkedList<String>();
     543        LinkedList<String> locations = new LinkedList<>();
    544544        locations.add(getPreferencesDir());
    545545        String s;
     
    594594
    595595    public synchronized Map<String, String> getAllPrefix(final String prefix) {
    596         final Map<String,String> all = new TreeMap<String,String>();
     596        final Map<String,String> all = new TreeMap<>();
    597597        for (final Entry<String,Setting> e : settingsMap.entrySet()) {
    598598            if (e.getKey().startsWith(prefix) && (e.getValue() instanceof StringSetting)) {
     
    604604
    605605    public synchronized List<String> getAllPrefixCollectionKeys(final String prefix) {
    606         final List<String> all = new LinkedList<String>();
     606        final List<String> all = new LinkedList<>();
    607607        for (Map.Entry<String, Setting> entry : settingsMap.entrySet()) {
    608608            if (entry.getKey().startsWith(prefix) && entry.getValue() instanceof ListSetting) {
     
    614614
    615615    public synchronized Map<String, String> getAllColors() {
    616         final Map<String,String> all = new TreeMap<String,String>();
     616        final Map<String,String> all = new TreeMap<>();
    617617        for (final Entry<String,Setting> e : defaultsMap.entrySet()) {
    618618            if (e.getKey().startsWith("color.") && e.getValue() instanceof StringSetting) {
     
    972972
    973973    public synchronized void removeFromCollection(String key, String value) {
    974         List<String> a = new ArrayList<String>(getCollection(key, Collections.<String>emptyList()));
     974        List<String> a = new ArrayList<>(getCollection(key, Collections.<String>emptyList()));
    975975        a.remove(value);
    976976        putCollection(key, a);
     
    10591059     */
    10601060    public boolean putCollectionBounded(String key, int maxsize, Collection<String> val) {
    1061         Collection<String> newCollection = new ArrayList<String>(Math.min(maxsize, val.size()));
     1061        Collection<String> newCollection = new ArrayList<>(Math.min(maxsize, val.size()));
    10621062        for (String i : val) {
    10631063            if (newCollection.size() >= maxsize) {
     
    10891089
    10901090    public Collection<Map<String, String>> getListOfStructs(String key, Collection<Map<String, String>> def) {
    1091         return getSetting(key, new MapListSetting(def == null ? null : new ArrayList<Map<String, String>>(def)), MapListSetting.class).getValue();
     1091        return getSetting(key, new MapListSetting(def == null ? null : new ArrayList<>(def)), MapListSetting.class).getValue();
    10921092    }
    10931093
    10941094    public boolean putListOfStructs(String key, Collection<Map<String, String>> value) {
    1095         return putSetting(key, value == null ? null : new MapListSetting(new ArrayList<Map<String, String>>(value)));
     1095        return putSetting(key, value == null ? null : new MapListSetting(new ArrayList<>(value)));
    10961096    }
    10971097
     
    11241124            getListOfStructs(key, def == null ? null : serializeListOfStructs(def, klass));
    11251125        if (prop == null)
    1126             return def == null ? null : new ArrayList<T>(def);
    1127         List<T> lst = new ArrayList<T>();
     1126            return def == null ? null : new ArrayList<>(def);
     1127        List<T> lst = new ArrayList<>();
    11281128        for (Map<String,String> entries : prop) {
    11291129            T struct = deserializeStruct(entries, klass);
     
    11531153        if (l == null)
    11541154            return null;
    1155         Collection<Map<String,String>> vals = new ArrayList<Map<String,String>>();
     1155        Collection<Map<String,String>> vals = new ArrayList<>();
    11561156        for (T struct : l) {
    11571157            if (struct == null) {
     
    11711171        }
    11721172
    1173         Map<String,String> hash = new LinkedHashMap<String,String>();
     1173        Map<String,String> hash = new LinkedHashMap<>();
    11741174        for (Field f : klass.getDeclaredFields()) {
    11751175            if (f.getAnnotation(pref.class) == null) {
     
    12441244
    12451245    public Map<String, Setting> getAllSettings() {
    1246         return new TreeMap<String, Setting>(settingsMap);
     1246        return new TreeMap<>(settingsMap);
    12471247    }
    12481248
    12491249    public Map<String, Setting> getAllDefaults() {
    1250         return new TreeMap<String, Setting>(defaultsMap);
     1250        return new TreeMap<>(defaultsMap);
    12511251    }
    12521252
     
    14021402                if ("entry".equals(localName)) {
    14031403                    if (entries == null) {
    1404                         entries = new ArrayList<String>();
     1404                        entries = new ArrayList<>();
    14051405                    }
    14061406                    entries.add(parser.getAttributeValue(null, "value"));
     
    14081408                } else if ("list".equals(localName)) {
    14091409                    if (lists == null) {
    1410                         lists = new ArrayList<List<String>>();
     1410                        lists = new ArrayList<>();
    14111411                    }
    14121412                    lists.add(parseInnerList());
    14131413                } else if ("map".equals(localName)) {
    14141414                    if (maps == null) {
    1415                         maps = new ArrayList<Map<String, String>>();
     1415                        maps = new ArrayList<>();
    14161416                    }
    14171417                    maps.add(parseMap());
     
    14411441
    14421442    protected List<String> parseInnerList() throws XMLStreamException {
    1443         List<String> entries = new ArrayList<String>();
     1443        List<String> entries = new ArrayList<>();
    14441444        while (true) {
    14451445            int event = parser.next();
     
    14591459
    14601460    protected Map<String, String> parseMap() throws XMLStreamException {
    1461         Map<String, String> map = new LinkedHashMap<String, String>();
     1461        Map<String, String> map = new LinkedHashMap<>();
    14621462        while (true) {
    14631463            int event = parser.next();
  • trunk/src/org/openstreetmap/josm/data/SystemOfMeasurement.java

    r6992 r7005  
    4848    public static final Map<String, SystemOfMeasurement> ALL_SYSTEMS;
    4949    static {
    50         ALL_SYSTEMS = new LinkedHashMap<String, SystemOfMeasurement>();
     50        ALL_SYSTEMS = new LinkedHashMap<>();
    5151        ALL_SYSTEMS.put(marktr("Metric"), METRIC);
    5252        ALL_SYSTEMS.put(marktr("Chinese"), CHINESE);
  • trunk/src/org/openstreetmap/josm/data/UndoRedoHandler.java

    r6994 r7005  
    2020     * All commands that were made on the dataset. Don't write from outside!
    2121     */
    22     public final LinkedList<Command> commands = new LinkedList<Command>();
     22    public final LinkedList<Command> commands = new LinkedList<>();
    2323    /**
    2424     * The stack for redoing commands
    2525     */
    26     public final LinkedList<Command> redoCommands = new LinkedList<Command>();
     26    public final LinkedList<Command> redoCommands = new LinkedList<>();
    2727
    28     private final LinkedList<CommandQueueListener> listenerCommands = new LinkedList<CommandQueueListener>();
     28    private final LinkedList<CommandQueueListener> listenerCommands = new LinkedList<>();
    2929
    3030    /**
  • trunk/src/org/openstreetmap/josm/data/Version.java

    r6990 r7005  
    7575
    7676    protected Map<String, String> parseManifestStyleFormattedString(String content) {
    77         Map<String, String> properties = new HashMap<String, String>();
     77        Map<String, String> properties = new HashMap<>();
    7878        if (content == null) return properties;
    7979        Pattern p = Pattern.compile("^([^:]+):(.*)$");
  • trunk/src/org/openstreetmap/josm/data/conflict/ConflictCollection.java

    r6555 r7005  
    6464     */
    6565    public ConflictCollection() {
    66         conflicts = new ArrayList<Conflict<? extends OsmPrimitive>>();
    67         listeners = new CopyOnWriteArrayList<IConflictListener>();
     66        conflicts = new ArrayList<>();
     67        listeners = new CopyOnWriteArrayList<>();
    6868    }
    6969
     
    148148     */
    149149    public void add(OsmPrimitive my, OsmPrimitive their) {
    150         addConflict(new Conflict<OsmPrimitive>(my, their));
     150        addConflict(new Conflict<>(my, their));
    151151        fireConflictAdded();
    152152    }
     
    322322     */
    323323    public Set<OsmPrimitive> getMyConflictParties() {
    324         HashSet<OsmPrimitive> ret = new HashSet<OsmPrimitive>();
     324        HashSet<OsmPrimitive> ret = new HashSet<>();
    325325        for (Conflict<?> c: conflicts) {
    326326            ret.add(c.getMy());
     
    336336     */
    337337    public Set<OsmPrimitive> getTheirConflictParties() {
    338         HashSet<OsmPrimitive> ret = new HashSet<OsmPrimitive>();
     338        HashSet<OsmPrimitive> ret = new HashSet<>();
    339339        for (Conflict<?> c: conflicts) {
    340340            ret.add(c.getTheir());
  • trunk/src/org/openstreetmap/josm/data/gpx/GpxData.java

    r6830 r7005  
    2626    public String creator;
    2727
    28     public final Collection<GpxTrack> tracks = new LinkedList<GpxTrack>();
    29     public final Collection<GpxRoute> routes = new LinkedList<GpxRoute>();
    30     public final Collection<WayPoint> waypoints = new LinkedList<WayPoint>();
     28    public final Collection<GpxTrack> tracks = new LinkedList<>();
     29    public final Collection<GpxRoute> routes = new LinkedList<>();
     30    public final Collection<WayPoint> waypoints = new LinkedList<>();
    3131
    3232    @SuppressWarnings("unchecked")
  • trunk/src/org/openstreetmap/josm/data/gpx/GpxRoute.java

    r6380 r7005  
    66
    77public class GpxRoute extends WithAttributes {
    8     public Collection<WayPoint> routePoints = new LinkedList<WayPoint>();
     8    public Collection<WayPoint> routePoints = new LinkedList<>();
    99}
  • trunk/src/org/openstreetmap/josm/data/gpx/ImmutableGpxTrack.java

    r5681 r7005  
    1818
    1919    public ImmutableGpxTrack(Collection<Collection<WayPoint>> trackSegs, Map<String, Object> attributes) {
    20         List<GpxTrackSegment> newSegments = new ArrayList<GpxTrackSegment>();
     20        List<GpxTrackSegment> newSegments = new ArrayList<>();
    2121        for (Collection<WayPoint> trackSeg: trackSegs) {
    2222            if (trackSeg != null && !trackSeg.isEmpty()) {
     
    2424            }
    2525        }
    26         this.attr = Collections.unmodifiableMap(new HashMap<String, Object>(attributes));
     26        this.attr = Collections.unmodifiableMap(new HashMap<>(attributes));
    2727        this.segments = Collections.unmodifiableCollection(newSegments);
    2828        this.length = calculateLength();
  • trunk/src/org/openstreetmap/josm/data/gpx/ImmutableGpxTrackSegment.java

    r6084 r7005  
    1515
    1616    public ImmutableGpxTrackSegment(Collection<WayPoint> wayPoints) {
    17         this.wayPoints = Collections.unmodifiableCollection(new ArrayList<WayPoint>(wayPoints));
     17        this.wayPoints = Collections.unmodifiableCollection(new ArrayList<>(wayPoints));
    1818        this.bounds = calculateBounds();
    1919        this.length = calculateLength();
  • trunk/src/org/openstreetmap/josm/data/gpx/WayPoint.java

    r6895 r7005  
    137137    @Override
    138138    public List<String> getTemplateKeys() {
    139         return new ArrayList<String>(attr.keySet());
     139        return new ArrayList<>(attr.keySet());
    140140    }
    141141}
  • trunk/src/org/openstreetmap/josm/data/gpx/WithAttributes.java

    r6830 r7005  
    1919     * The "attr" hash is used to store the XML payload (not only XML attributes!)
    2020     */
    21     public Map<String, Object> attr = new HashMap<String, Object>(0);
     21    public Map<String, Object> attr = new HashMap<>(0);
    2222
    2323    /**
  • trunk/src/org/openstreetmap/josm/data/imagery/GeorefImage.java

    r6296 r7005  
    169169                img.getGraphics().dispose();
    170170                g.drawImage(img, x, y, null);
    171                 reImg = new SoftReference<BufferedImage>(img);
     171                reImg = new SoftReference<>(img);
    172172            }
    173173        } catch(Exception e) {
  • trunk/src/org/openstreetmap/josm/data/imagery/ImageryInfo.java

    r6990 r7005  
    9595        }
    9696
    97         private List<Shape> shapes = new ArrayList<Shape>();
     97        private List<Shape> shapes = new ArrayList<>();
    9898
    9999        /**
     
    546546        if (serverProjections == null || serverProjections.isEmpty()) {
    547547            try {
    548                 serverProjections = new ArrayList<String>();
     548                serverProjections = new ArrayList<>();
    549549                Matcher m = Pattern.compile(".*\\{PROJ\\(([^)}]+)\\)\\}.*").matcher(url.toUpperCase());
    550550                if(m.matches()) {
     
    710710
    711711    public void setServerProjections(Collection<String> serverProjections) {
    712         this.serverProjections = new ArrayList<String>(serverProjections);
     712        this.serverProjections = new ArrayList<>(serverProjections);
    713713    }
    714714
  • trunk/src/org/openstreetmap/josm/data/imagery/ImageryLayerInfo.java

    r6897 r7005  
    2222
    2323    public static final ImageryLayerInfo instance = new ImageryLayerInfo();
    24     List<ImageryInfo> layers = new ArrayList<ImageryInfo>();
    25     static List<ImageryInfo> defaultLayers = new ArrayList<ImageryInfo>();
     24    List<ImageryInfo> layers = new ArrayList<>();
     25    static List<ImageryInfo> defaultLayers = new ArrayList<>();
    2626
    2727    private static final String[] DEFAULT_LAYER_SITES = {
     
    9292
    9393        Collection<String> defaults = Main.pref.getCollection("imagery.layers.default");
    94         List<String> defaultsSave = new ArrayList<String>();
     94        List<String> defaultsSave = new ArrayList<>();
    9595        for (ImageryInfo def : defaultLayers) {
    9696            if (def.isDefaultEntry()) {
     
    137137
    138138    public void save() {
    139         List<ImageryPreferenceEntry> entries = new ArrayList<ImageryPreferenceEntry>();
     139        List<ImageryPreferenceEntry> entries = new ArrayList<>();
    140140        for (ImageryInfo info : layers) {
    141141            entries.add(new ImageryPreferenceEntry(info));
  • trunk/src/org/openstreetmap/josm/data/imagery/OffsetBookmark.java

    r6316 r7005  
    1616
    1717public class OffsetBookmark {
    18     public static final List<OffsetBookmark> allBookmarks = new ArrayList<OffsetBookmark>();
     18    public static final List<OffsetBookmark> allBookmarks = new ArrayList<>();
    1919
    2020    public String projectionCode;
     
    4545
    4646    public OffsetBookmark(Collection<String> list) {
    47         List<String> array = new ArrayList<String>(list);
     47        List<String> array = new ArrayList<>(list);
    4848        this.projectionCode = array.get(0);
    4949        this.layerName = array.get(1);
     
    6161
    6262    public List<String> getInfoArray() {
    63         List<String> res = new ArrayList<String>(7);
     63        List<String> res = new ArrayList<>(7);
    6464        if (projectionCode != null) {
    6565            res.add(projectionCode);
     
    8686
    8787    public static void saveBookmarks() {
    88         LinkedList<Collection<String>> coll = new LinkedList<Collection<String>>();
     88        LinkedList<Collection<String>> coll = new LinkedList<>();
    8989        for (OffsetBookmark b : allBookmarks) {
    9090            coll.add(b.getInfoArray());
  • trunk/src/org/openstreetmap/josm/data/imagery/Shape.java

    r6822 r7005  
    2020public class Shape {
    2121
    22     private List<Coordinate> coords = new ArrayList<Coordinate>();
     22    private List<Coordinate> coords = new ArrayList<>();
    2323
    2424    public Shape(String asString, String separator) throws IllegalArgumentException {
     
    5353        if (latlon == null)
    5454            return false;
    55         List<Node> nodes = new ArrayList<Node>(coords.size());
     55        List<Node> nodes = new ArrayList<>(coords.size());
    5656        for (Coordinate c : coords) {
    5757            nodes.add(new Node(new LatLon(c.getLat(), c.getLon())));
  • trunk/src/org/openstreetmap/josm/data/imagery/WmsCache.java

    r6992 r7005  
    7676        final String projection;
    7777        final String cacheDirectory;
    78         final List<CacheEntry> entries = new ArrayList<WmsCache.CacheEntry>();
     78        final List<CacheEntry> entries = new ArrayList<>();
    7979
    8080        ProjectionEntries(String projection, String cacheDirectory) {
     
    8484    }
    8585
    86     private final Map<String, ProjectionEntries> entries = new HashMap<String, ProjectionEntries>();
     86    private final Map<String, ProjectionEntries> entries = new HashMap<>();
    8787    private final File cacheDir;
    8888    private final int tileSize; // Should be always 500
     
    9090    private boolean totalFileSizeDirty; // Some file was missing - size needs to be recalculated
    9191    // No need for hashCode/equals on CacheEntry, object identity is enough. Comparing by values can lead to error - CacheEntry for wrong projection could be found
    92     private Map<CacheEntry, SoftReference<BufferedImage>> memoryCache = new HashMap<WmsCache.CacheEntry, SoftReference<BufferedImage>>();
     92    private Map<CacheEntry, SoftReference<BufferedImage>> memoryCache = new HashMap<>();
    9393    private Set<ProjectionBounds> areaToCache;
    9494
     
    210210    private void removeNonReferencedFiles() {
    211211
    212         Set<String> usedProjections = new HashSet<String>();
     212        Set<String> usedProjections = new HashSet<>();
    213213
    214214        for (ProjectionEntries projectionEntries: entries.values()) {
     
    218218            File projectionDir = new File(cacheDir, projectionEntries.cacheDirectory);
    219219            if (projectionDir.exists()) {
    220                 Set<String> referencedFiles = new HashSet<String>();
     220                Set<String> referencedFiles = new HashSet<>();
    221221
    222222                for (CacheEntry ce: projectionEntries.entries) {
     
    373373        List<CacheEntry> matches;
    374374        synchronized (this) {
    375             matches = new ArrayList<WmsCache.CacheEntry>();
     375            matches = new ArrayList<>();
    376376
    377377            double minPPD = pixelPerDegree / 5;
     
    410410
    411411        boolean drawAtLeastOnce = false;
    412         Map<CacheEntry, SoftReference<BufferedImage>> localCache = new HashMap<WmsCache.CacheEntry, SoftReference<BufferedImage>>();
     412        Map<CacheEntry, SoftReference<BufferedImage>> localCache = new HashMap<>();
    413413        for (CacheEntry ce: matches) {
    414414            BufferedImage img;
    415415            try {
    416416                img = loadImage(projectionEntries, ce);
    417                 localCache.put(ce, new SoftReference<BufferedImage>(img));
     417                localCache.put(ce, new SoftReference<>(img));
    418418            } catch (IOException e) {
    419419                continue;
  • trunk/src/org/openstreetmap/josm/data/imagery/types/ProjectionType.java

    r6897 r7005  
    7171    public List<EntryType> getEntry() {
    7272        if (entry == null) {
    73             entry = new ArrayList<EntryType>();
     73            entry = new ArrayList<>();
    7474        }
    7575        return this.entry;
  • trunk/src/org/openstreetmap/josm/data/imagery/types/WmsCacheType.java

    r6897 r7005  
    7373    public List<ProjectionType> getProjection() {
    7474        if (projection == null) {
    75             projection = new ArrayList<ProjectionType>();
     75            projection = new ArrayList<>();
    7676        }
    7777        return this.projection;
  • trunk/src/org/openstreetmap/josm/data/osm/AbstractPrimitive.java

    r6889 r7005  
    471471    @Override
    472472    public Map<String, String> getKeys() {
    473         Map<String, String> result = new HashMap<String, String>();
     473        Map<String, String> result = new HashMap<>();
    474474        String[] keys = this.keys;
    475475        if (keys != null) {
     
    638638        if (keys == null)
    639639            return Collections.emptySet();
    640         Set<String> result = new HashSet<String>(keys.length / 2);
     640        Set<String> result = new HashSet<>(keys.length / 2);
    641641        for (int i=0; i<keys.length; i+=2) {
    642642            result.add(keys[i]);
  • trunk/src/org/openstreetmap/josm/data/osm/Changeset.java

    r6830 r7005  
    5959        this.id = id;
    6060        this.incomplete = id > 0;
    61         this.tags = new HashMap<String, String>();
     61        this.tags = new HashMap<>();
    6262    }
    6363
     
    7070        if (other == null) {
    7171            this.id = 0;
    72             this.tags = new HashMap<String, String>();
     72            this.tags = new HashMap<>();
    7373        } else if (other.isIncomplete()) {
    7474            setId(other.getId());
    7575            this.incomplete = true;
    76             this.tags = new HashMap<String, String>();
     76            this.tags = new HashMap<>();
    7777        } else {
    7878            this.id = other.id;
     
    286286        this.min = other.min;
    287287        this.max = other.max;
    288         this.tags = new HashMap<String, String>(other.tags);
     288        this.tags = new HashMap<>(other.tags);
    289289        this.incomplete = other.incomplete;
    290290
  • trunk/src/org/openstreetmap/josm/data/osm/ChangesetCache.java

    r6990 r7005  
    4646
    4747    /** the cached changesets */
    48     private final Map<Integer, Changeset> cache  = new HashMap<Integer, Changeset>();
     48    private final Map<Integer, Changeset> cache  = new HashMap<>();
    4949
    5050    private final CopyOnWriteArrayList<ChangesetCacheListener> listeners =
    51         new CopyOnWriteArrayList<ChangesetCacheListener>();
     51        new CopyOnWriteArrayList<>();
    5252
    5353    private ChangesetCache() {
     
    117117
    118118    public Set<Changeset> getChangesets() {
    119         return new HashSet<Changeset>(cache.values());
     119        return new HashSet<>(cache.values());
    120120    }
    121121
     
    180180     */
    181181    public List<Changeset> getOpenChangesets() {
    182         List<Changeset> ret = new ArrayList<Changeset>();
     182        List<Changeset> ret = new ArrayList<>();
    183183        for (Changeset cs: cache.values()) {
    184184            if (cs.isOpen()) {
  • trunk/src/org/openstreetmap/josm/data/osm/ChangesetDataSet.java

    r6889 r7005  
    2828    }
    2929
    30     private final Map<PrimitiveId, HistoryOsmPrimitive> primitives = new HashMap<PrimitiveId, HistoryOsmPrimitive>();
    31     private final Map<PrimitiveId, ChangesetModificationType> modificationTypes = new HashMap<PrimitiveId, ChangesetModificationType>();
     30    private final Map<PrimitiveId, HistoryOsmPrimitive> primitives = new HashMap<>();
     31    private final Map<PrimitiveId, ChangesetModificationType> modificationTypes = new HashMap<>();
    3232
    3333    /**
     
    116116    public Set<HistoryOsmPrimitive> getPrimitivesByModificationType(ChangesetModificationType cmt) throws IllegalArgumentException {
    117117        CheckParameterUtil.ensureParameterNotNull(cmt,"cmt");
    118         HashSet<HistoryOsmPrimitive> ret = new HashSet<HistoryOsmPrimitive>();
     118        HashSet<HistoryOsmPrimitive> ret = new HashSet<>();
    119119        for (Entry<PrimitiveId, ChangesetModificationType> entry: modificationTypes.entrySet()) {
    120120            if (entry.getValue().equals(cmt)) {
  • trunk/src/org/openstreetmap/josm/data/osm/DataSet.java

    r6920 r7005  
    102102    private static final int MAX_EVENTS = 1000;
    103103
    104     private Storage<OsmPrimitive> allPrimitives = new Storage<OsmPrimitive>(new Storage.PrimitiveIdHash(), true);
     104    private Storage<OsmPrimitive> allPrimitives = new Storage<>(new Storage.PrimitiveIdHash(), true);
    105105    private Map<PrimitiveId, OsmPrimitive> primitivesMap = allPrimitives.foreignKey(new Storage.PrimitiveIdHash());
    106     private CopyOnWriteArrayList<DataSetListener> listeners = new CopyOnWriteArrayList<DataSetListener>();
     106    private CopyOnWriteArrayList<DataSetListener> listeners = new CopyOnWriteArrayList<>();
    107107
    108108    // provide means to highlight map elements that are not osm primitives
    109     private Collection<WaySegment> highlightedVirtualNodes = new LinkedList<WaySegment>();
    110     private Collection<WaySegment> highlightedWaySegments = new LinkedList<WaySegment>();
     109    private Collection<WaySegment> highlightedVirtualNodes = new LinkedList<>();
     110    private Collection<WaySegment> highlightedWaySegments = new LinkedList<>();
    111111
    112112    // Number of open calls to beginUpdate
    113113    private int updateCount;
    114114    // Events that occurred while dataset was locked but should be fired after write lock is released
    115     private final List<AbstractDatasetChangedEvent> cachedEvents = new ArrayList<AbstractDatasetChangedEvent>();
     115    private final List<AbstractDatasetChangedEvent> cachedEvents = new ArrayList<>();
    116116
    117117    private int highlightUpdateCount;
     
    146146     * History of selections - shared by plugins and SelectionListDialog
    147147     */
    148     private final LinkedList<Collection<? extends OsmPrimitive>> selectionHistory = new LinkedList<Collection<? extends OsmPrimitive>>();
     148    private final LinkedList<Collection<? extends OsmPrimitive>> selectionHistory = new LinkedList<>();
    149149
    150150    /**
     
    211211     * Holding bin for changeset tag information, to be applied when or if this is ever uploaded.
    212212     */
    213     private Map<String, String> changeSetTags = new HashMap<String, String>();
     213    private Map<String, String> changeSetTags = new HashMap<>();
    214214
    215215    public Map<String, String> getChangeSetTags() {
     
    225225     * conversion of the whole DataSet by iterating over this data structure.
    226226     */
    227     private QuadBuckets<Node> nodes = new QuadBuckets<Node>();
     227    private QuadBuckets<Node> nodes = new QuadBuckets<>();
    228228
    229229    private <T extends OsmPrimitive> Collection<T> getPrimitives(Predicate<OsmPrimitive> predicate) {
    230         return new SubclassFilteredCollection<OsmPrimitive, T>(allPrimitives, predicate);
     230        return new SubclassFilteredCollection<>(allPrimitives, predicate);
    231231    }
    232232
     
    254254     * The way nodes are stored only in the way list.
    255255     */
    256     private QuadBuckets<Way> ways = new QuadBuckets<Way>();
     256    private QuadBuckets<Way> ways = new QuadBuckets<>();
    257257
    258258    /**
     
    277277     * All relations/relationships
    278278     */
    279     private Collection<Relation> relations = new ArrayList<Relation>();
     279    private Collection<Relation> relations = new ArrayList<>();
    280280
    281281    /**
     
    292292        try {
    293293            // QuadBuckets might be useful here (don't forget to do reindexing after some of rm is changed)
    294             List<Relation> result = new ArrayList<Relation>();
     294            List<Relation> result = new ArrayList<>();
    295295            for (Relation r: relations) {
    296296                if (r.getBBox().intersects(bbox)) {
     
    307307     * All data sources of this DataSet.
    308308     */
    309     public final Collection<DataSource> dataSources = new LinkedList<DataSource>();
     309    public final Collection<DataSource> dataSources = new LinkedList<>();
    310310
    311311    /**
     
    412412     * dataset. (However, the selection does only change in the active layer)
    413413     */
    414     private static final Collection<SelectionChangedListener> selListeners = new CopyOnWriteArrayList<SelectionChangedListener>();
     414    private static final Collection<SelectionChangedListener> selListeners = new CopyOnWriteArrayList<>();
    415415
    416416    public static void addSelectionListener(SelectionChangedListener listener) {
     
    434434    }
    435435
    436     private Set<OsmPrimitive> selectedPrimitives = new LinkedHashSet<OsmPrimitive>();
     436    private Set<OsmPrimitive> selectedPrimitives = new LinkedHashSet<>();
    437437    private Collection<OsmPrimitive> selectionSnapshot;
    438438
    439439    public Collection<OsmPrimitive> getSelectedNodesAndWays() {
    440         return new FilteredCollection<OsmPrimitive>(getSelected(), new Predicate<OsmPrimitive>() {
     440        return new FilteredCollection<>(getSelected(), new Predicate<OsmPrimitive>() {
    441441            @Override
    442442            public boolean evaluate(OsmPrimitive primitive) {
     
    474474     */
    475475    public Collection<OsmPrimitive> getSelected() {
    476         return new SubclassFilteredCollection<OsmPrimitive, OsmPrimitive>(getAllSelected(), OsmPrimitive.nonDeletedPredicate);
     476        return new SubclassFilteredCollection<>(getAllSelected(), OsmPrimitive.nonDeletedPredicate);
    477477    }
    478478
     
    487487        synchronized (selectionLock) {
    488488            if (selectionSnapshot == null) {
    489                 selectionSnapshot = Collections.unmodifiableList(new ArrayList<OsmPrimitive>(selectedPrimitives));
     489                selectionSnapshot = Collections.unmodifiableList(new ArrayList<>(selectedPrimitives));
    490490            }
    491491            currentList = selectionSnapshot;
     
    498498     */
    499499    public Collection<Node> getSelectedNodes() {
    500         return new SubclassFilteredCollection<OsmPrimitive, Node>(getSelected(), OsmPrimitive.nodePredicate);
     500        return new SubclassFilteredCollection<>(getSelected(), OsmPrimitive.nodePredicate);
    501501    }
    502502
     
    505505     */
    506506    public Collection<Way> getSelectedWays() {
    507         return new SubclassFilteredCollection<OsmPrimitive, Way>(getSelected(), OsmPrimitive.wayPredicate);
     507        return new SubclassFilteredCollection<>(getSelected(), OsmPrimitive.wayPredicate);
    508508    }
    509509
     
    512512     */
    513513    public Collection<Relation> getSelectedRelations() {
    514         return new SubclassFilteredCollection<OsmPrimitive, Relation>(getSelected(), OsmPrimitive.relationPredicate);
     514        return new SubclassFilteredCollection<>(getSelected(), OsmPrimitive.relationPredicate);
    515515    }
    516516
     
    592592        boolean changed;
    593593        synchronized (selectionLock) {
    594             LinkedHashSet<OsmPrimitive> oldSelection = new LinkedHashSet<OsmPrimitive>(selectedPrimitives);
    595             selectedPrimitives = new LinkedHashSet<OsmPrimitive>();
     594            LinkedHashSet<OsmPrimitive> oldSelection = new LinkedHashSet<>(selectedPrimitives);
     595            selectedPrimitives = new LinkedHashSet<>();
    596596            addSelected(selection, false);
    597597            changed = !oldSelection.equals(selectedPrimitives);
     
    719719        try {
    720720            DataSet ds = new DataSet();
    721             HashMap<OsmPrimitive, OsmPrimitive> primMap = new HashMap<OsmPrimitive, OsmPrimitive>();
     721            HashMap<OsmPrimitive, OsmPrimitive> primMap = new HashMap<>();
    722722            for (Node n : nodes) {
    723723                Node newNode = new Node(n);
     
    728728                Way newWay = new Way(w);
    729729                primMap.put(w, newWay);
    730                 List<Node> newNodes = new ArrayList<Node>();
     730                List<Node> newNodes = new ArrayList<>();
    731731                for (Node n: w.getNodes()) {
    732732                    newNodes.add((Node)primMap.get(n));
     
    745745            for (Relation r : relations) {
    746746                Relation newRelation = (Relation)primMap.get(r);
    747                 List<RelationMember> newMembers = new ArrayList<RelationMember>();
     747                List<RelationMember> newMembers = new ArrayList<>();
    748748                for (RelationMember rm: r.getMembers()) {
    749749                    newMembers.add(new RelationMember(rm.getRole(), primMap.get(rm.getMember())));
     
    821821     */
    822822    public Set<Way> unlinkNodeFromWays(Node node) {
    823         Set<Way> result = new HashSet<Way>();
     823        Set<Way> result = new HashSet<>();
    824824        beginUpdate();
    825825        try {
     
    848848     */
    849849    public Set<Relation> unlinkPrimitiveFromRelations(OsmPrimitive primitive) {
    850         Set<Relation> result = new HashSet<Relation>();
     850        Set<Relation> result = new HashSet<>();
    851851        beginUpdate();
    852852        try {
     
    882882     */
    883883    public Set<OsmPrimitive> unlinkReferencesToPrimitive(OsmPrimitive referencedPrimitive) {
    884         Set<OsmPrimitive> result = new HashSet<OsmPrimitive>();
     884        Set<OsmPrimitive> result = new HashSet<>();
    885885        beginUpdate();
    886886        try {
     
    983983            updateCount--;
    984984            if (updateCount == 0) {
    985                 List<AbstractDatasetChangedEvent> eventsCopy = new ArrayList<AbstractDatasetChangedEvent>(cachedEvents);
     985                List<AbstractDatasetChangedEvent> eventsCopy = new ArrayList<>(cachedEvents);
    986986                cachedEvents.clear();
    987987                lock.writeLock().unlock();
     
    11591159     */
    11601160    public List<Bounds> getDataSourceBounds() {
    1161         List<Bounds> ret = new ArrayList<Bounds>(dataSources.size());
     1161        List<Bounds> ret = new ArrayList<>(dataSources.size());
    11621162        for (DataSource ds : dataSources) {
    11631163            if (ds.bounds != null) {
  • trunk/src/org/openstreetmap/josm/data/osm/DataSetMerger.java

    r6881 r7005  
    5959        this.sourceDataSet = sourceDataSet;
    6060        conflicts = new ConflictCollection();
    61         mergedMap = new HashMap<PrimitiveId, PrimitiveId>();
    62         objectsWithChildrenToMerge = new HashSet<PrimitiveId>();
    63         objectsToDelete = new HashSet<OsmPrimitive>();
     61        mergedMap = new HashMap<>();
     62        objectsWithChildrenToMerge = new HashSet<>();
     63        objectsToDelete = new HashSet<>();
    6464    }
    6565
     
    137137
    138138    protected void addConflict(OsmPrimitive my, OsmPrimitive their) {
    139         addConflict(new Conflict<OsmPrimitive>(my, their));
     139        addConflict(new Conflict<>(my, their));
    140140    }
    141141
     
    238238            throw new IllegalStateException(tr("Missing merge target for way with id {0}", source.getUniqueId()));
    239239
    240         List<Node> newNodes = new ArrayList<Node>(source.getNodesCount());
     240        List<Node> newNodes = new ArrayList<>(source.getNodesCount());
    241241        for (Node sourceNode : source.getNodes()) {
    242242            Node targetNode = (Node)getMergeTarget(sourceNode);
     
    264264        if (target == null)
    265265            throw new IllegalStateException(tr("Missing merge target for relation with id {0}", source.getUniqueId()));
    266         LinkedList<RelationMember> newMembers = new LinkedList<RelationMember>();
     266        LinkedList<RelationMember> newMembers = new LinkedList<>();
    267267        for (RelationMember sourceMember : source.getMembers()) {
    268268            OsmPrimitive targetMember = getMergeTarget(sourceMember.getMember());
     
    272272            newMembers.add(newMember);
    273273            if (targetMember.isDeleted() && !conflicts.hasConflictForMy(targetMember)) {
    274                 addConflict(new Conflict<OsmPrimitive>(targetMember, sourceMember.getMember(), true));
     274                addConflict(new Conflict<>(targetMember, sourceMember.getMember(), true));
    275275                targetMember.setDeleted(false);
    276276            }
     
    326326            for (OsmPrimitive referrer: source.getReferrers()) {
    327327                if (targetDataSet.getPrimitiveById(referrer.getPrimitiveId()) == null) {
    328                     addConflict(new Conflict<OsmPrimitive>(target, source, true));
     328                    addConflict(new Conflict<>(target, source, true));
    329329                    target.setDeleted(false);
    330330                    break;
     
    403403        targetDataSet.beginUpdate();
    404404        try {
    405             List<? extends OsmPrimitive> candidates = new ArrayList<Node>(targetDataSet.getNodes());
     405            List<? extends OsmPrimitive> candidates = new ArrayList<>(targetDataSet.getNodes());
    406406            for (Node node: sourceDataSet.getNodes()) {
    407407                mergePrimitive(node, candidates);
     
    411411            }
    412412            candidates.clear();
    413             candidates = new ArrayList<Way>(targetDataSet.getWays());
     413            candidates = new ArrayList<>(targetDataSet.getWays());
    414414            for (Way way: sourceDataSet.getWays()) {
    415415                mergePrimitive(way, candidates);
     
    419419            }
    420420            candidates.clear();
    421             candidates = new ArrayList<Relation>(targetDataSet.getRelations());
     421            candidates = new ArrayList<>(targetDataSet.getRelations());
    422422            for (Relation relation: sourceDataSet.getRelations()) {
    423423                mergePrimitive(relation, candidates);
  • trunk/src/org/openstreetmap/josm/data/osm/DefaultChangesetCacheEvent.java

    r6084 r7005  
    1616    public DefaultChangesetCacheEvent(ChangesetCache source) {
    1717        this.source = source;
    18         added = new HashSet<Changeset>();
    19         modified = new HashSet<Changeset>();
    20         removed = new HashSet<Changeset>();
     18        added = new HashSet<>();
     19        modified = new HashSet<>();
     20        removed = new HashSet<>();
    2121    }
    2222
  • trunk/src/org/openstreetmap/josm/data/osm/FilterMatcher.java

    r5909 r7005  
    9090    }
    9191
    92     private final List<FilterInfo> hiddenFilters = new ArrayList<FilterInfo>();
    93     private final List<FilterInfo> disabledFilters = new ArrayList<FilterInfo>();
     92    private final List<FilterInfo> hiddenFilters = new ArrayList<>();
     93    private final List<FilterInfo> disabledFilters = new ArrayList<>();
    9494
    9595    public void update(Collection<Filter> filters) throws ParseError {
  • trunk/src/org/openstreetmap/josm/data/osm/MultipolygonCreate.java

    r6841 r7005  
    4949         */
    5050        private List<Node> getNodes() {
    51             List<Node> nodes = new ArrayList<Node>();
     51            List<Node> nodes = new ArrayList<>();
    5252
    5353            for(int waypos = 0; waypos < this.ways.size(); waypos ++) {
     
    8585            this.outerWay = _pol;
    8686            this.level = _level;
    87             this.innerWays = new ArrayList<JoinedPolygon>();
     87            this.innerWays = new ArrayList<>();
    8888        }
    8989    }
     
    9898
    9999    public MultipolygonCreate(){
    100         this.outerWays = new ArrayList<JoinedPolygon>(0);
    101         this.innerWays = new ArrayList<JoinedPolygon>(0);
     100        this.outerWays = new ArrayList<>(0);
     101        this.innerWays = new ArrayList<>(0);
    102102    }
    103103
     
    109109     */
    110110    public String makeFromWays(Collection<Way> ways){
    111         List<JoinedPolygon> joinedWays = new ArrayList<JoinedPolygon>();
     111        List<JoinedPolygon> joinedWays = new ArrayList<>();
    112112
    113113        //collect ways connecting to each node.
    114         MultiMap<Node, Way> nodesWithConnectedWays = new MultiMap<Node, Way>();
    115         Set<Way> usedWays = new HashSet<Way>();
     114        MultiMap<Node, Way> nodesWithConnectedWays = new MultiMap<>();
     115        Set<Way> usedWays = new HashSet<>();
    116116
    117117        for(Way w: ways) {
     
    139139
    140140            Node startNode = startWay.firstNode();
    141             List<Way> collectedWays = new ArrayList<Way>();
    142             List<Boolean> collectedWaysReverse = new ArrayList<Boolean>();
     141            List<Way> collectedWays = new ArrayList<>();
     142            List<Boolean> collectedWaysReverse = new ArrayList<>();
    143143            Way curWay = startWay;
    144144            Node prevNode = startNode;
     
    197197        }
    198198
    199         this.outerWays = new ArrayList<JoinedPolygon>(0);
    200         this.innerWays = new ArrayList<JoinedPolygon>(0);
     199        this.outerWays = new ArrayList<>(0);
     200        this.innerWays = new ArrayList<>(0);
    201201
    202202        //take every other level
     
    221221
    222222        //TODO: bad performance for deep nesting...
    223         List<PolygonLevel> result = new ArrayList<PolygonLevel>();
     223        List<PolygonLevel> result = new ArrayList<>();
    224224
    225225        for (JoinedPolygon outerWay : boundaryWays) {
    226226
    227227            boolean outerGood = true;
    228             List<JoinedPolygon> innerCandidates = new ArrayList<JoinedPolygon>();
     228            List<JoinedPolygon> innerCandidates = new ArrayList<>();
    229229
    230230            for (JoinedPolygon innerWay : boundaryWays) {
  • trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java

    r6890 r7005  
    121121    public static <T extends OsmPrimitive>  List<T> getFilteredList(Collection<OsmPrimitive> list, Class<T> type) {
    122122        if (list == null) return Collections.emptyList();
    123         List<T> ret = new LinkedList<T>();
     123        List<T> ret = new LinkedList<>();
    124124        for(OsmPrimitive p: list) {
    125125            if (type.isInstance(p)) {
     
    142142     */
    143143    public static <T extends OsmPrimitive> Set<T> getFilteredSet(Collection<OsmPrimitive> set, Class<T> type) {
    144         Set<T> ret = new LinkedHashSet<T>();
     144        Set<T> ret = new LinkedHashSet<>();
    145145        if (set != null) {
    146146            for(OsmPrimitive p: set) {
     
    161161     */
    162162    public static Set<OsmPrimitive> getReferrer(Collection<? extends OsmPrimitive> primitives) {
    163         HashSet<OsmPrimitive> ret = new HashSet<OsmPrimitive>();
     163        HashSet<OsmPrimitive> ret = new HashSet<>();
    164164        if (primitives == null || primitives.isEmpty()) return ret;
    165165        for (OsmPrimitive p: primitives) {
     
    632632    public static Collection<String> getUninterestingKeys() {
    633633        if (uninteresting == null) {
    634             LinkedList<String> l = new LinkedList<String>(Arrays.asList(
     634            LinkedList<String> l = new LinkedList<>(Arrays.asList(
    635635                "source", "source_ref", "source:", "comment",
    636636                "converted_by", "watch", "watch:",
     
    731731     */
    732732    public Map<String, String> getInterestingTags() {
    733         Map<String, String> result = new HashMap<String, String>();
     733        Map<String, String> result = new HashMap<>();
    734734        String[] keys = this.keys;
    735735        if (keys != null) {
     
    997997        checkDataset();
    998998        Object referrers = this.referrers;
    999         List<OsmPrimitive> result = new ArrayList<OsmPrimitive>();
     999        List<OsmPrimitive> result = new ArrayList<>();
    10001000        if (referrers != null) {
    10011001            if (referrers instanceof OsmPrimitive) {
     
    12981298    public Collection<String> getTemplateKeys() {
    12991299        Collection<String> keySet = keySet();
    1300         List<String> result = new ArrayList<String>(keySet.size() + 2);
     1300        List<String> result = new ArrayList<>(keySet.size() + 2);
    13011301        result.add(SPECIAL_VALUE_ID);
    13021302        result.add(SPECIAL_VALUE_LOCAL_NAME);
     
    13311331     */
    13321332    public static Set<Relation> getParentRelations(Collection<? extends OsmPrimitive> primitives) {
    1333         HashSet<Relation> ret = new HashSet<Relation>();
     1333        HashSet<Relation> ret = new HashSet<>();
    13341334        for (OsmPrimitive w : primitives) {
    13351335            ret.addAll(OsmPrimitive.getFilteredList(w.getReferrers(), Relation.class));
  • trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitiveComparator.java

    r6889 r7005  
    1010/** Comparator, comparing by type and objects display names */
    1111public class OsmPrimitiveComparator implements Comparator<OsmPrimitive> {
    12     private final Map<OsmPrimitive, String> cache= new HashMap<OsmPrimitive, String>();
     12    private final Map<OsmPrimitive, String> cache= new HashMap<>();
    1313    private final DefaultNameFormatter df = DefaultNameFormatter.getInstance();
    1414    public boolean relationsFirst = false;
  • trunk/src/org/openstreetmap/josm/data/osm/OsmUtils.java

    r6792 r7005  
    1313    }
    1414
    15     static final List<String> TRUE_VALUES = new ArrayList<String>(Arrays
     15    static final List<String> TRUE_VALUES = new ArrayList<>(Arrays
    1616            .asList(new String[] { "true", "yes", "1", "on" }));
    17     static final List<String> FALSE_VALUES = new ArrayList<String>(Arrays
     17    static final List<String> FALSE_VALUES = new ArrayList<>(Arrays
    1818            .asList(new String[] { "false", "no", "0", "off" }));
    19     static final List<String> REVERSE_VALUES = new ArrayList<String>(Arrays
     19    static final List<String> REVERSE_VALUES = new ArrayList<>(Arrays
    2020            .asList(new String[] { "reverse", "-1" }));
    2121
  • trunk/src/org/openstreetmap/josm/data/osm/PrimitiveData.java

    r6889 r7005  
    5555    @SuppressWarnings("unchecked")
    5656    public static <T extends PrimitiveData> List<T> getFilteredList(Collection<T> list, OsmPrimitiveType type) {
    57         List<T> ret = new ArrayList<T>();
     57        List<T> ret = new ArrayList<>();
    5858        for(PrimitiveData p: list) {
    5959            if (type.getDataClass().isInstance(p)) {
  • trunk/src/org/openstreetmap/josm/data/osm/PrimitiveDeepCopy.java

    r6890 r7005  
    2222    }
    2323
    24     private final List<PrimitiveData> directlyAdded = new ArrayList<PrimitiveData>();
    25     private final List<PrimitiveData> referenced = new ArrayList<PrimitiveData>();
    26     private final CopyOnWriteArrayList<PasteBufferChangedListener> listeners = new CopyOnWriteArrayList<PasteBufferChangedListener>();
     24    private final List<PrimitiveData> directlyAdded = new ArrayList<>();
     25    private final List<PrimitiveData> referenced = new ArrayList<>();
     26    private final CopyOnWriteArrayList<PasteBufferChangedListener> listeners = new CopyOnWriteArrayList<>();
    2727
    2828    public PrimitiveDeepCopy() {
     
    4242        referenced.clear();
    4343
    44         final Set<Long> visitedNodeIds = new HashSet<Long>();
    45         final Set<Long> visitedWayIds = new HashSet<Long>();
    46         final Set<Long> visitedRelationIds = new HashSet<Long>();
     44        final Set<Long> visitedNodeIds = new HashSet<>();
     45        final Set<Long> visitedWayIds = new HashSet<>();
     46        final Set<Long> visitedRelationIds = new HashSet<>();
    4747
    4848        new AbstractVisitor() {
     
    9696
    9797    public List<PrimitiveData> getAll() {
    98         List<PrimitiveData> result = new ArrayList<PrimitiveData>(directlyAdded.size() + referenced.size());
     98        List<PrimitiveData> result = new ArrayList<>(directlyAdded.size() + referenced.size());
    9999        result.addAll(directlyAdded);
    100100        result.addAll(referenced);
  • trunk/src/org/openstreetmap/josm/data/osm/QuadBuckets.java

    r6890 r7005  
    5050            case NE_INDEX:
    5151                if (ne == null) {
    52                     ne = new QBLevel<T>(this, index, buckets);
     52                    ne = new QBLevel<>(this, index, buckets);
    5353                }
    5454                return ne;
    5555            case NW_INDEX:
    5656                if (nw == null) {
    57                     nw = new QBLevel<T>(this, index, buckets);
     57                    nw = new QBLevel<>(this, index, buckets);
    5858                }
    5959                return nw;
    6060            case SE_INDEX:
    6161                if (se == null) {
    62                     se = new QBLevel<T>(this, index, buckets);
     62                    se = new QBLevel<>(this, index, buckets);
    6363                }
    6464                return se;
    6565            case SW_INDEX:
    6666                if (sw == null) {
    67                     sw = new QBLevel<T>(this, index, buckets);
     67                    sw = new QBLevel<>(this, index, buckets);
    6868                }
    6969                return sw;
     
    174174            // The split_lock will keep two concurrent calls from overwriting content
    175175            if (content == null) {
    176                 content = new ArrayList<T>();
     176                content = new ArrayList<>();
    177177            }
    178178            ret = content.add(o);
     
    405405    @Override
    406406    public final void clear() {
    407         root = new QBLevel<T>(this);
     407        root = new QBLevel<>(this);
    408408        search_cache = null;
    409409        size = 0;
     
    478478
    479479    public ArrayList<T> toArrayList() {
    480         ArrayList<T> a = new ArrayList<T>();
     480        ArrayList<T> a = new ArrayList<>();
    481481        for (T n : this) {
    482482            a.add(n);
     
    581581
    582582    public List<T> search(BBox search_bbox) {
    583         List<T> ret = new ArrayList<T>();
     583        List<T> ret = new ArrayList<>();
    584584        // Doing this cuts down search cost on a real-life data set by about 25%
    585585        boolean cache_searches = true;
  • trunk/src/org/openstreetmap/josm/data/osm/Relation.java

    r6830 r7005  
    3535     */
    3636    public List<RelationMember> getMembers() {
    37         return new CopyList<RelationMember>(members);
     37        return new CopyList<>(members);
    3838    }
    3939
     
    241241            RelationData relationData = (RelationData) data;
    242242
    243             List<RelationMember> newMembers = new ArrayList<RelationMember>();
     243            List<RelationMember> newMembers = new ArrayList<>();
    244244            for (RelationMemberData member : relationData.getMembers()) {
    245245                OsmPrimitive primitive = getDataSet().getPrimitiveById(member);
     
    384384     */
    385385    public Set<OsmPrimitive> getMemberPrimitives() {
    386         HashSet<OsmPrimitive> ret = new HashSet<OsmPrimitive>();
     386        HashSet<OsmPrimitive> ret = new HashSet<>();
    387387        RelationMember[] members = this.members;
    388388        for (RelationMember m: members) {
     
    521521     */
    522522    public Collection<OsmPrimitive> getIncompleteMembers() {
    523         Set<OsmPrimitive> ret = new HashSet<OsmPrimitive>();
     523        Set<OsmPrimitive> ret = new HashSet<>();
    524524        RelationMember[] members = this.members;
    525525        for (RelationMember rm: members) {
  • trunk/src/org/openstreetmap/josm/data/osm/RelationData.java

    r6009 r7005  
    99public class RelationData extends PrimitiveData implements IRelation {
    1010
    11     private List<RelationMemberData> members = new ArrayList<RelationMemberData>();
     11    private List<RelationMemberData> members = new ArrayList<>();
    1212
    1313    public RelationData() {
     
    2525
    2626    public void setMembers(List<RelationMemberData> memberData) {
    27         members = new ArrayList<RelationMemberData>(memberData);
     27        members = new ArrayList<>(memberData);
    2828    }
    2929
  • trunk/src/org/openstreetmap/josm/data/osm/RelationToChildReference.java

    r6889 r7005  
    1616    public static Set<RelationToChildReference> getRelationToChildReferences(OsmPrimitive child) {
    1717        Set<Relation> parents = OsmPrimitive.getFilteredSet(child.getReferrers(), Relation.class);
    18         Set<RelationToChildReference> references = new HashSet<RelationToChildReference>();
     18        Set<RelationToChildReference> references = new HashSet<>();
    1919        for (Relation parent: parents) {
    2020            for (int i=0; i < parent.getMembersCount(); i++) {
     
    3535     */
    3636    public static Set<RelationToChildReference> getRelationToChildReferences(Collection<? extends OsmPrimitive> children) {
    37         Set<RelationToChildReference> references = new HashSet<RelationToChildReference>();
     37        Set<RelationToChildReference> references = new HashSet<>();
    3838        for (OsmPrimitive child: children) {
    3939            references.addAll(getRelationToChildReferences(child));
  • trunk/src/org/openstreetmap/josm/data/osm/SimplePrimitiveId.java

    r6674 r7005  
    9494     */
    9595    public static List<SimplePrimitiveId> fuzzyParse(String s) {
    96         final ArrayList<SimplePrimitiveId> ids = new ArrayList<SimplePrimitiveId>();
     96        final ArrayList<SimplePrimitiveId> ids = new ArrayList<>();
    9797        final Matcher m = ID_PATTERN.matcher(s);
    9898        while (m.find()) {
  • trunk/src/org/openstreetmap/josm/data/osm/Storage.java

    r6830 r7005  
    257257
    258258    public <K> Map<K,T> foreignKey(Hash<K,? super T> h) {
    259         return new FMap<K>(h);
     259        return new FMap<>(h);
    260260    }
    261261
  • trunk/src/org/openstreetmap/josm/data/osm/TagCollection.java

    r6890 r7005  
    141141    }
    142142
    143     private final Set<Tag> tags = new HashSet<Tag>();
     143    private final Set<Tag> tags = new HashSet<>();
    144144
    145145    /**
     
    469469     */
    470470    public Set<Tag> asSet() {
    471         return new HashSet<Tag>(tags);
     471        return new HashSet<>(tags);
    472472    }
    473473
     
    479479     */
    480480    public List<Tag> asList() {
    481         return new ArrayList<Tag>(tags);
     481        return new ArrayList<>(tags);
    482482    }
    483483
     
    498498     */
    499499    public Set<String> getKeys() {
    500         HashSet<String> ret = new HashSet<String>();
     500        HashSet<String> ret = new HashSet<>();
    501501        for (Tag tag: tags) {
    502502            ret.add(tag.getKey());
     
    511511     */
    512512    public Set<String> getKeysWithMultipleValues() {
    513         HashMap<String, Integer> counters = new HashMap<String, Integer>();
     513        HashMap<String, Integer> counters = new HashMap<>();
    514514        for (Tag tag: tags) {
    515515            Integer v = counters.get(tag.getKey());
    516516            counters.put(tag.getKey(),(v==null) ? 1 : v+1);
    517517        }
    518         Set<String> ret = new HashSet<String>();
     518        Set<String> ret = new HashSet<>();
    519519        for (Entry<String, Integer> e : counters.entrySet()) {
    520520            if (e.getValue() > 1) {
     
    556556     */
    557557    public Set<String> getValues() {
    558         HashSet<String> ret = new HashSet<String>();
     558        HashSet<String> ret = new HashSet<>();
    559559        for (Tag tag: tags) {
    560560            ret.add(tag.getValue());
     
    572572     */
    573573    public Set<String> getValues(String key) {
    574         HashSet<String> ret = new HashSet<String>();
     574        HashSet<String> ret = new HashSet<>();
    575575        if (key == null) return ret;
    576576        for (Tag tag: tags) {
     
    733733        }
    734734
    735         Set<String> values = new LinkedHashSet<String>();
    736         Map<String, Collection<String>> originalSplitValues = new LinkedHashMap<String, Collection<String>>();
     735        Set<String> values = new LinkedHashSet<>();
     736        Map<String, Collection<String>> originalSplitValues = new LinkedHashMap<>();
    737737        for (String v : originalValues) {
    738738            List<String> vs = Arrays.asList(SPLIT_VALUES_PATTERN.split(v));
  • trunk/src/org/openstreetmap/josm/data/osm/TigerUtils.java

    r6990 r7005  
    4646
    4747    public static String combineTags(String name, Set<String> values) {
    48         TreeSet<Object> resultSet = new TreeSet<Object>();
     48        TreeSet<Object> resultSet = new TreeSet<>();
    4949        for (String value: values) {
    5050            String[] parts = value.split(":");
     
    6868
    6969    public static String combineTags(String name, String t1, String t2) {
    70         Set<String> set = new TreeSet<String>();
     70        Set<String> set = new TreeSet<>();
    7171        set.add(t1);
    7272        set.add(t2);
  • trunk/src/org/openstreetmap/josm/data/osm/User.java

    r6889 r7005  
    3030     * the map of known users
    3131     */
    32     private static Map<Long,User> userMap = new HashMap<Long,User>();
     32    private static Map<Long,User> userMap = new HashMap<>();
    3333    private static final User anonymous = createLocalUser(tr("<anonymous>"));
    3434
     
    102102            name = "";
    103103        }
    104         List<User> ret = new ArrayList<User>();
     104        List<User> ret = new ArrayList<>();
    105105        for (User user: userMap.values()) {
    106106            if (user.hasName(name)) {
     
    120120
    121121    /** the user name */
    122     private final Set<String> names = new HashSet<String>();
     122    private final Set<String> names = new HashSet<>();
    123123    /** the user id */
    124124    private final long uid;
     
    139139     */
    140140    public List<String> getNames() {
    141         return new ArrayList<String>(names);
     141        return new ArrayList<>(names);
    142142    }
    143143
  • trunk/src/org/openstreetmap/josm/data/osm/Way.java

    r6830 r7005  
    4242     */
    4343    public List<Node> getNodes() {
    44         return new CopyList<Node>(nodes);
     44        return new CopyList<>(nodes);
    4545    }
    4646
     
    167167     */
    168168    public Set<Node> getNeighbours(Node node) {
    169         HashSet<Node> neigh = new HashSet<Node>();
     169        HashSet<Node> neigh = new HashSet<>();
    170170
    171171        if (node == null) return neigh;
     
    191191     */
    192192    public List<Pair<Node,Node>> getNodePairs(boolean sort) {
    193         List<Pair<Node,Node>> chunkSet = new ArrayList<Pair<Node,Node>>();
     193        List<Pair<Node,Node>> chunkSet = new ArrayList<>();
    194194        if (isIncomplete()) return chunkSet;
    195195        Node lastN = null;
     
    200200                continue;
    201201            }
    202             Pair<Node,Node> np = new Pair<Node,Node>(lastN, n);
     202            Pair<Node,Node> np = new Pair<>(lastN, n);
    203203            if (sort) {
    204204                Pair.sort(np);
     
    284284            WayData wayData = (WayData) data;
    285285
    286             List<Node> newNodes = new ArrayList<Node>(wayData.getNodes().size());
     286            List<Node> newNodes = new ArrayList<>(wayData.getNodes().size());
    287287            for (Long nodeId : wayData.getNodes()) {
    288288                Node node = (Node)getDataSet().getPrimitiveById(nodeId, OsmPrimitiveType.NODE);
     
    386386        try {
    387387            boolean closed = (lastNode() == firstNode() && selection.contains(lastNode()));
    388             List<Node> copy = new ArrayList<Node>();
     388            List<Node> copy = new ArrayList<>();
    389389
    390390            for (Node n: nodes) {
  • trunk/src/org/openstreetmap/josm/data/osm/WayData.java

    r6009 r7005  
    99public class WayData extends PrimitiveData implements IWay {
    1010
    11     private List<Long> nodes = new ArrayList<Long>();
     11    private List<Long> nodes = new ArrayList<>();
    1212
    1313    public WayData() {
     
    4141
    4242    public void setNodes(List<Long> nodes) {
    43         this.nodes = new ArrayList<Long>(nodes);
     43        this.nodes = new ArrayList<>(nodes);
    4444    }
    4545
  • trunk/src/org/openstreetmap/josm/data/osm/event/DatasetEventManager.java

    r6084 r7005  
    6868    }
    6969
    70     private final Queue<AbstractDatasetChangedEvent> eventsInEDT = new LinkedBlockingQueue<AbstractDatasetChangedEvent>();
    71     private final CopyOnWriteArrayList<ListenerInfo> inEDTListeners = new CopyOnWriteArrayList<ListenerInfo>();
    72     private final CopyOnWriteArrayList<ListenerInfo> normalListeners = new CopyOnWriteArrayList<ListenerInfo>();
     70    private final Queue<AbstractDatasetChangedEvent> eventsInEDT = new LinkedBlockingQueue<>();
     71    private final CopyOnWriteArrayList<ListenerInfo> inEDTListeners = new CopyOnWriteArrayList<>();
     72    private final CopyOnWriteArrayList<ListenerInfo> normalListeners = new CopyOnWriteArrayList<>();
    7373    private final DataSetListener myListener = new DataSetListenerAdapter(this);
    7474
     75    /**
     76     * Constructs a new {@code DatasetEventManager}.
     77     */
    7578    public DatasetEventManager() {
    7679        MapView.addEditLayerChangeListener(this);
     
    139142        public void run() {
    140143            while (!eventsInEDT.isEmpty()) {
    141                 List<AbstractDatasetChangedEvent> events = new ArrayList<AbstractDatasetChangedEvent>();
     144                List<AbstractDatasetChangedEvent> events = new ArrayList<>();
    142145                events.addAll(eventsInEDT);
    143146
     
    187190                            }
    188191                        } else {
    189                             consolidatedEvent = new DataChangedEvent(dataSet,
    190                                     new ArrayList<AbstractDatasetChangedEvent>(Arrays.asList(consolidatedEvent)));
     192                            consolidatedEvent = new DataChangedEvent(dataSet, new ArrayList<>(Arrays.asList(consolidatedEvent)));
    191193                        }
    192194
  • trunk/src/org/openstreetmap/josm/data/osm/event/PrimitivesAddedEvent.java

    r5170 r7005  
    1717    public PrimitivesAddedEvent(DataSet dataSet, Collection<? extends OsmPrimitive> primitives, boolean wasIncomplete) {
    1818        super(dataSet);
    19         this.primitives = Collections.unmodifiableList(new ArrayList<OsmPrimitive>(primitives));
     19        this.primitives = Collections.unmodifiableList(new ArrayList<>(primitives));
    2020        this.wasIncomplete = wasIncomplete;
    2121    }
  • trunk/src/org/openstreetmap/josm/data/osm/event/PrimitivesRemovedEvent.java

    r5170 r7005  
    1717    public PrimitivesRemovedEvent(DataSet dataSet, Collection<? extends OsmPrimitive> primitives, boolean wasComplete) {
    1818        super(dataSet);
    19         this.primitives = Collections.unmodifiableList(new ArrayList<OsmPrimitive>(primitives));
     19        this.primitives = Collections.unmodifiableList(new ArrayList<>(primitives));
    2020        this.wasComplete = wasComplete;
    2121    }
  • trunk/src/org/openstreetmap/josm/data/osm/event/SelectionEventManager.java

    r6361 r7005  
    4545
    4646    private Collection<? extends OsmPrimitive> selection;
    47     private final CopyOnWriteArrayList<ListenerInfo> inEDTListeners = new CopyOnWriteArrayList<ListenerInfo>();
    48     private final CopyOnWriteArrayList<ListenerInfo> normalListeners = new CopyOnWriteArrayList<ListenerInfo>();
     47    private final CopyOnWriteArrayList<ListenerInfo> inEDTListeners = new CopyOnWriteArrayList<>();
     48    private final CopyOnWriteArrayList<ListenerInfo> normalListeners = new CopyOnWriteArrayList<>();
    4949
    5050    /**
  • trunk/src/org/openstreetmap/josm/data/osm/history/History.java

    r6830 r7005  
    2525
    2626    private static History filter(History history, FilterPredicate predicate) {
    27         List<HistoryOsmPrimitive> out = new ArrayList<HistoryOsmPrimitive>();
     27        List<HistoryOsmPrimitive> out = new ArrayList<>();
    2828        for (HistoryOsmPrimitive primitive: history.versions) {
    2929            if (predicate.matches(primitive)) {
     
    5656        this.id = id;
    5757        this.type = type;
    58         this.versions = new ArrayList<HistoryOsmPrimitive>();
     58        this.versions = new ArrayList<>();
    5959        if (versions != null) {
    6060            this.versions.addAll(versions);
     
    6363
    6464    public History sortAscending() {
    65         List<HistoryOsmPrimitive> copy = new ArrayList<HistoryOsmPrimitive>(versions);
     65        List<HistoryOsmPrimitive> copy = new ArrayList<>(versions);
    6666        Collections.sort(
    6767                copy,
     
    7777
    7878    public History sortDescending() {
    79         List<HistoryOsmPrimitive> copy = new ArrayList<HistoryOsmPrimitive>(versions);
     79        List<HistoryOsmPrimitive> copy = new ArrayList<>(versions);
    8080        Collections.sort(
    8181                copy,
  • trunk/src/org/openstreetmap/josm/data/osm/history/HistoryDataSet.java

    r6830 r7005  
    5252     */
    5353    public HistoryDataSet() {
    54         data = new HashMap<PrimitiveId, ArrayList<HistoryOsmPrimitive>>();
    55         listeners = new CopyOnWriteArrayList<HistoryDataSetListener>();
    56         changesets = new HashMap<Long, Changeset>();
     54        data = new HashMap<>();
     55        listeners = new CopyOnWriteArrayList<>();
     56        changesets = new HashMap<>();
    5757    }
    5858
     
    187187
    188188    public Collection<Long> getChangesetIds() {
    189         final HashSet<Long> ids = new HashSet<Long>();
     189        final HashSet<Long> ids = new HashSet<>();
    190190        for (Collection<HistoryOsmPrimitive> i : data.values()) {
    191191            for (HistoryOsmPrimitive j : i) {
  • trunk/src/org/openstreetmap/josm/data/osm/history/HistoryOsmPrimitive.java

    r6890 r7005  
    8989        this.changesetId  = changesetId;
    9090        this.timestamp = timestamp;
    91         tags = new HashMap<String, String>();
     91        tags = new HashMap<>();
    9292    }
    9393
     
    191191    public void setTags(Map<String,String> tags) {
    192192        if (tags == null) {
    193             this.tags = new HashMap<String, String>();
     193            this.tags = new HashMap<>();
    194194        } else {
    195             this.tags = new HashMap<String, String>(tags);
     195            this.tags = new HashMap<>(tags);
    196196        }
    197197    }
  • trunk/src/org/openstreetmap/josm/data/osm/history/HistoryRelation.java

    r6830 r7005  
    2121public class HistoryRelation extends HistoryOsmPrimitive{
    2222
    23     private List<RelationMemberData> members = new ArrayList<RelationMemberData>();
     23    private List<RelationMemberData> members = new ArrayList<>();
    2424
    2525    /**
  • trunk/src/org/openstreetmap/josm/data/osm/history/HistoryWay.java

    r6830 r7005  
    2121public class HistoryWay extends HistoryOsmPrimitive {
    2222
    23     private List<Long> nodeIds = new ArrayList<Long>();
     23    private List<Long> nodeIds = new ArrayList<>();
    2424
    2525    /**
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/AllNodesVisitor.java

    r6380 r7005  
    2121     * The resulting nodes collected so far.
    2222     */
    23     public Collection<Node> nodes = new HashSet<Node>();
     23    public Collection<Node> nodes = new HashSet<>();
    2424
    2525    /**
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/MergeSourceBuildingVisitor.java

    r6317 r7005  
    4949        this.selectionBase = selectionBase;
    5050        this.hull = new DataSet();
    51         this.mappedPrimitives = new HashMap<OsmPrimitive, PrimitiveData>();
     51        this.mappedPrimitives = new HashMap<>();
    5252    }
    5353
     
    8080            return;
    8181        WayData clone = w.save();
    82         List<Long> newNodes = new ArrayList<Long>(w.getNodesCount());
     82        List<Long> newNodes = new ArrayList<>(w.getNodesCount());
    8383        for (Node n: w.getNodes()) {
    8484            newNodes.add(mappedPrimitives.get(n).getUniqueId());
     
    102102        }
    103103
    104         List<RelationMemberData> newMembers = new ArrayList<RelationMemberData>();
     104        List<RelationMemberData> newMembers = new ArrayList<>();
    105105        for (RelationMember member: r.getMembers()) {
    106106            newMembers.add(
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/MapRendererFactory.java

    r7004 r7005  
    110110    }
    111111
    112     private final List<Descriptor> descriptors = new ArrayList<Descriptor>();
     112    private final List<Descriptor> descriptors = new ArrayList<>();
    113113    private Class<? extends AbstractMapRenderer> activeRenderer = null;
    114114
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java

    r6926 r7005  
    183183            this.drawMultipolygon = drawMultipolygon;
    184184            this.drawRestriction = drawRestriction;
    185             styleElems = new ArrayList<StyleRecord>();
     185            styleElems = new ArrayList<>();
    186186        }
    187187
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/WireframeMapRenderer.java

    r6380 r7005  
    168168
    169169        // draw tagged ways first, then untagged ways, then highlighted ways
    170         List<Way> highlightedWays = new ArrayList<Way>();
    171         List<Way> untaggedWays = new ArrayList<Way>();
     170        List<Way> highlightedWays = new ArrayList<>();
     171        List<Way> untaggedWays = new ArrayList<>();
    172172
    173173        for (final Way way : data.searchWays(bbox)){
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/relations/Multipolygon.java

    r6890 r7005  
    5656     */
    5757    private static class MultipolygonRoleMatcher implements PreferenceChangedListener{
    58         private final List<String> outerExactRoles = new ArrayList<String>();
    59         private final List<String> outerRolePrefixes = new ArrayList<String>();
    60         private final List<String> innerExactRoles = new ArrayList<String>();
    61         private final List<String> innerRolePrefixes = new ArrayList<String>();
     58        private final List<String> outerExactRoles = new ArrayList<>();
     59        private final List<String> outerRolePrefixes = new ArrayList<>();
     60        private final List<String> innerExactRoles = new ArrayList<>();
     61        private final List<String> innerRolePrefixes = new ArrayList<>();
    6262
    6363        private void initDefaults() {
     
    202202        private PolyData(List<Node> nodes, boolean selected, Collection<Long> wayIds) {
    203203            this.wayIds = Collections.unmodifiableCollection(wayIds);
    204             this.nodes = new ArrayList<Node>(nodes);
     204            this.nodes = new ArrayList<>(nodes);
    205205            this.selected = selected;
    206             this.inners = new ArrayList<Multipolygon.PolyData>();
     206            this.inners = new ArrayList<>();
    207207            this.poly = new Path2D.Double();
    208208            this.poly.setWindingRule(Path2D.WIND_EVEN_ODD);
     
    235235            this.poly = (Double) copy.poly.clone();
    236236            this.wayIds = Collections.unmodifiableCollection(copy.wayIds);
    237             this.nodes = new ArrayList<Node>(copy.nodes);
    238             this.inners = new ArrayList<Multipolygon.PolyData>(copy.inners);
     237            this.nodes = new ArrayList<>(copy.nodes);
     238            this.inners = new ArrayList<>(copy.inners);
    239239        }
    240240
     
    297297                    nodes.addAll(w.getNodes());
    298298                } else if (!wayIds.isEmpty()) {
    299                     List<Way> waysToJoin = new ArrayList<Way>();
     299                    List<Way> waysToJoin = new ArrayList<>();
    300300                    for (Long wayId : wayIds) {
    301301                        Way w = (Way) ds.getPrimitiveById(wayId, OsmPrimitiveType.WAY);
     
    347347    }
    348348
    349     private final List<Way> innerWays = new ArrayList<Way>();
    350     private final List<Way> outerWays = new ArrayList<Way>();
    351     private final List<PolyData> innerPolygons = new ArrayList<PolyData>();
    352     private final List<PolyData> outerPolygons = new ArrayList<PolyData>();
    353     private final List<PolyData> combinedPolygons = new ArrayList<PolyData>();
     349    private final List<Way> innerWays = new ArrayList<>();
     350    private final List<Way> outerWays = new ArrayList<>();
     351    private final List<PolyData> innerPolygons = new ArrayList<>();
     352    private final List<PolyData> outerPolygons = new ArrayList<>();
     353    private final List<PolyData> combinedPolygons = new ArrayList<>();
    354354
    355355    private boolean incomplete;
     
    397397
    398398    private void createPolygons(List<Way> ways, List<PolyData> result) {
    399         List<Way> waysToJoin = new ArrayList<Way>();
     399        List<Way> waysToJoin = new ArrayList<>();
    400400        for (Way way: ways) {
    401401            if (way.isClosed()) {
     
    413413    public static Collection<JoinedWay> joinWays(Collection<Way> waysToJoin)
    414414    {
    415         final Collection<JoinedWay> result = new ArrayList<JoinedWay>();
     415        final Collection<JoinedWay> result = new ArrayList<>();
    416416        final Way[] joinArray = waysToJoin.toArray(new Way[waysToJoin.size()]);
    417417        int left = waysToJoin.size();
     
    420420            boolean selected = false;
    421421            List<Node> nodes = null;
    422             Set<Long> wayIds = new HashSet<Long>();
     422            Set<Long> wayIds = new HashSet<>();
    423423            boolean joined = true;
    424424            while (joined && left > 0) {
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/relations/MultipolygonCache.java

    r6986 r7005  
    4747   
    4848    private MultipolygonCache() {
    49         this.cache = new HashMap<NavigatableComponent, Map<DataSet, Map<Relation, Multipolygon>>>();
    50         this.selectedPolyData = new ArrayList<Multipolygon.PolyData>();
     49        this.cache = new HashMap<>();
     50        this.selectedPolyData = new ArrayList<>();
    5151        Main.addProjectionChangeListener(this);
    5252        DataSet.addSelectionListener(this);
     
    7171            Map<DataSet, Map<Relation, Multipolygon>> map1 = cache.get(nc);
    7272            if (map1 == null) {
    73                 cache.put(nc, map1 = new HashMap<DataSet, Map<Relation, Multipolygon>>());
     73                cache.put(nc, map1 = new HashMap<>());
    7474            }
    7575            Map<Relation, Multipolygon> map2 = map1.get(r.getDataSet());
    7676            if (map2 == null) {
    77                 map1.put(r.getDataSet(), map2 = new HashMap<Relation, Multipolygon>());
     77                map1.put(r.getDataSet(), map2 = new HashMap<>());
    7878            }
    7979            multipolygon = map2.get(r);
     
    113113   
    114114    private final Collection<Map<Relation, Multipolygon>> getMapsFor(DataSet ds) {
    115         List<Map<Relation, Multipolygon>> result = new ArrayList<Map<Relation, Multipolygon>>();
     115        List<Map<Relation, Multipolygon>> result = new ArrayList<>();
    116116        for (Map<DataSet, Map<Relation, Multipolygon>> map : cache.values()) {
    117117            Map<Relation, Multipolygon> map2 = map.get(ds);
  • trunk/src/org/openstreetmap/josm/data/projection/CustomProjection.java

    r6990 r7005  
    7575        public boolean hasValue;
    7676
    77         public static final Map<String, Param> paramsByKey = new HashMap<String, Param>();
     77        public static final Map<String, Param> paramsByKey = new HashMap<>();
    7878        static {
    7979            for (Param p : Param.values()) {
     
    161161
    162162    private Map<String, String> parseParameterList(String pref) throws ProjectionConfigurationException {
    163         Map<String, String> parameters = new HashMap<String, String>();
     163        Map<String, String> parameters = new HashMap<>();
    164164        String[] parts = Utils.WHITE_SPACES_PATTERN.split(pref.trim());
    165165        if (pref.trim().isEmpty()) {
     
    292292        if (numStr.length != 3 && numStr.length != 7)
    293293            throw new ProjectionConfigurationException(tr("Unexpected number of arguments for parameter ''towgs84'' (must be 3 or 7)"));
    294         List<Double> towgs84Param = new ArrayList<Double>();
     294        List<Double> towgs84Param = new ArrayList<>();
    295295        for (String str : numStr) {
    296296            try {
  • trunk/src/org/openstreetmap/josm/data/projection/Projections.java

    r6995 r7005  
    6060     * should be compatible to PROJ.4
    6161     */
    62     public static final Map<String, ProjFactory> projs = new HashMap<String, ProjFactory>();
    63     public static final Map<String, Ellipsoid> ellipsoids = new HashMap<String, Ellipsoid>();
    64     public static final Map<String, Datum> datums = new HashMap<String, Datum>();
    65     public static final Map<String, NTV2GridShiftFileWrapper> nadgrids = new HashMap<String, NTV2GridShiftFileWrapper>();
    66     public static final Map<String, Pair<String, String>> inits = new HashMap<String, Pair<String, String>>();
     62    public static final Map<String, ProjFactory> projs = new HashMap<>();
     63    public static final Map<String, Ellipsoid> ellipsoids = new HashMap<>();
     64    public static final Map<String, Datum> datums = new HashMap<>();
     65    public static final Map<String, NTV2GridShiftFileWrapper> nadgrids = new HashMap<>();
     66    public static final Map<String, Pair<String, String>> inits = new HashMap<>();
    6767
    6868    static {
     
    158158    }
    159159
    160     private static final Set<String> allCodes = new HashSet<String>();
    161     private static final Map<String, ProjectionChoice> allProjectionChoicesByCode = new HashMap<String, ProjectionChoice>();
    162     private static final Map<String, Projection> projectionsByCode_cache = new HashMap<String, Projection>();
     160    private static final Set<String> allCodes = new HashSet<>();
     161    private static final Map<String, ProjectionChoice> allProjectionChoicesByCode = new HashMap<>();
     162    private static final Map<String, Projection> projectionsByCode_cache = new HashMap<>();
    163163
    164164    static {
  • trunk/src/org/openstreetmap/josm/data/projection/datum/NTV2GridShiftFile.java

    r6995 r7005  
    167167    private NTV2SubGrid[] createSubGridTree(NTV2SubGrid[] subGrid) {
    168168        int topLevelCount = 0;
    169         HashMap<String, List<NTV2SubGrid>> subGridMap = new HashMap<String, List<NTV2SubGrid>>();
     169        HashMap<String, List<NTV2SubGrid>> subGridMap = new HashMap<>();
    170170        for (int i = 0; i < subGrid.length; i++) {
    171171            if ("NONE".equalsIgnoreCase(subGrid[i].getParentSubGridName())) {
  • 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.