Changeset 7005 in josm for trunk/src/org/openstreetmap/josm/data
- Timestamp:
- 2014-04-26T17:39:23+02:00 (10 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/data
- Files:
-
- 96 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/APIDataSet.java
r6890 r7005 44 44 */ 45 45 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<>(); 49 49 } 50 50 … … 122 122 public boolean participatesInConflict(ConflictCollection conflicts) { 123 123 if (conflicts == null || conflicts.isEmpty()) return false; 124 Set<PrimitiveId> idsParticipatingInConflicts = new HashSet< PrimitiveId>();124 Set<PrimitiveId> idsParticipatingInConflicts = new HashSet<>(); 125 125 for (OsmPrimitive p: conflicts.getMyConflictParties()) { 126 126 idsParticipatingInConflicts.add(p.getPrimitiveId()); … … 190 190 */ 191 191 public List<OsmPrimitive> getPrimitives() { 192 LinkedList<OsmPrimitive> ret = new LinkedList< OsmPrimitive>();192 LinkedList<OsmPrimitive> ret = new LinkedList<>(); 193 193 ret.addAll(toAdd); 194 194 ret.addAll(toUpdate); … … 223 223 */ 224 224 public void adjustRelationUploadOrder() throws CyclicUploadDependencyException{ 225 LinkedList<OsmPrimitive> newToAdd = new LinkedList< OsmPrimitive>();225 LinkedList<OsmPrimitive> newToAdd = new LinkedList<>(); 226 226 newToAdd.addAll(Utils.filteredCollection(toAdd, Node.class)); 227 227 newToAdd.addAll(Utils.filteredCollection(toAdd, Way.class)); 228 228 229 List<Relation> relationsToAdd = new ArrayList< Relation>(Utils.filteredCollection(toAdd, Relation.class));229 List<Relation> relationsToAdd = new ArrayList<>(Utils.filteredCollection(toAdd, Relation.class)); 230 230 List<Relation> noProblemRelations = filterRelationsNotReferringToNewRelations(relationsToAdd); 231 231 newToAdd.addAll(noProblemRelations); … … 236 236 toAdd = newToAdd; 237 237 238 LinkedList<OsmPrimitive> newToDelete = new LinkedList< OsmPrimitive>();238 LinkedList<OsmPrimitive> newToDelete = new LinkedList<>(); 239 239 graph = new RelationUploadDependencyGraph(Utils.filteredCollection(toDelete, Relation.class), false); 240 240 newToDelete.addAll(graph.computeUploadOrder()); … … 253 253 */ 254 254 protected List<Relation> filterRelationsNotReferringToNewRelations(Collection<Relation> relations) { 255 List<Relation> ret = new LinkedList< Relation>();255 List<Relation> ret = new LinkedList<>(); 256 256 for (Relation relation: relations) { 257 257 boolean refersToNewRelation = false; … … 275 275 */ 276 276 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<>(); 278 278 private Collection<Relation> relations; 279 private Set<Relation> visited = new HashSet< Relation>();279 private Set<Relation> visited = new HashSet<>(); 280 280 private List<Relation> uploadOrder; 281 281 private final boolean newOrUndeleted; … … 287 287 288 288 public final void build(Collection<Relation> relations) { 289 this.relations = new HashSet< Relation>();289 this.relations = new HashSet<>(); 290 290 for(Relation relation: relations) { 291 291 if (newOrUndeleted ? !relation.isNewOrUndeleted() : !relation.isDeleted()) { … … 304 304 Set<Relation> p = children.get(relation); 305 305 if (p == null) { 306 p = new HashSet< Relation>();306 p = new HashSet<>(); 307 307 children.put(relation, p); 308 308 } … … 331 331 332 332 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<>(); 336 336 for (Relation relation: relations) { 337 337 visit(path, relation); 338 338 } 339 List<Relation> ret = new ArrayList< Relation>(relations);339 List<Relation> ret = new ArrayList<>(relations); 340 340 Collections.sort( 341 341 ret, -
trunk/src/org/openstreetmap/josm/data/AutosaveTask.java
r6995 r7005 76 76 String layerName; 77 77 String layerFileName; 78 final Deque<File> backupFiles = new LinkedList< File>();78 final Deque<File> backupFiles = new LinkedList<>(); 79 79 } 80 80 81 81 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<>(); 84 84 private Timer timer; 85 85 private final Object layersLock = new Object(); 86 private final Deque<File> deletedLayers = new LinkedList< File>();86 private final Deque<File> deletedLayers = new LinkedList<>(); 87 87 88 88 private final File autosaveDir = new File(Main.pref.getPreferencesDir() + AUTOSAVE_DIR); … … 300 300 */ 301 301 public List<File> getUnsavedLayersFiles() { 302 List<File> result = new ArrayList< File>();302 List<File> result = new ArrayList<>(); 303 303 File[] files = autosaveDir.listFiles(OsmImporter.FILE_FILTER); 304 304 if (files == null) -
trunk/src/org/openstreetmap/josm/data/CustomConfigurator.java
r6987 r7005 201 201 */ 202 202 public static void exportPreferencesKeysToFile(String filename, boolean append, String... keys) { 203 HashSet<String> keySet = new HashSet< String>();203 HashSet<String> keySet = new HashSet<>(); 204 204 Collections.addAll(keySet, keys); 205 205 exportPreferencesKeysToFile(filename, append, keySet); … … 215 215 */ 216 216 public static void exportPreferencesKeysByPatternToFile(String fileName, boolean append, String pattern) { 217 List<String> keySet = new ArrayList< String>();217 List<String> keySet = new ArrayList<>(); 218 218 Map<String, Setting> allSettings = Main.pref.getAllSettings(); 219 219 for (String key: allSettings.keySet()) { … … 317 317 318 318 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<>(); 322 322 Collections.addAll(installList, install.toLowerCase().split(";")); 323 323 Collections.addAll(removeList, uninstall.toLowerCase().split(";")); … … 351 351 public void run() { 352 352 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<>(); 356 356 for (PluginInformation pi: availablePlugins) { 357 357 String name = pi.name.toLowerCase(); … … 364 364 Main.worker.submit(pluginDownloadTask); 365 365 } 366 Collection<String> pls = new ArrayList< String>(Main.pref.getCollection("plugins"));366 Collection<String> pls = new ArrayList<>(Main.pref.getCollection("plugins")); 367 367 for (PluginInformation pi: toInstallPlugins) { 368 368 if (!pls.contains(pi.name)) { … … 415 415 416 416 Preferences mainPrefs; 417 Map<String,Element> tasksMap = new HashMap< String,Element>();417 Map<String,Element> tasksMap = new HashMap<>(); 418 418 419 419 private boolean lastV; // last If condition result … … 888 888 } 889 889 if (existing != null) 890 return new ArrayList< String>(existing.getValue());890 return new ArrayList<>(existing.getValue()); 891 891 else 892 return defaults.getValue() == null ? null : new ArrayList< String>(defaults.getValue());892 return defaults.getValue() == null ? null : new ArrayList<>(defaults.getValue()); 893 893 } 894 894 … … 917 917 918 918 if (existing != null) 919 return new ArrayList< Map<String, String>>(existing.getValue());919 return new ArrayList<>(existing.getValue()); 920 920 else 921 return defaults.getValue() == null ? null : new ArrayList< Map<String, String>>(defaults.getValue());921 return defaults.getValue() == null ? null : new ArrayList<>(defaults.getValue()); 922 922 } 923 923 … … 1003 1003 tmpPref.settingsMap.clear(); 1004 1004 1005 Map<String, Setting> tmp = new HashMap< String, Setting>();1005 Map<String, Setting> tmp = new HashMap<>(); 1006 1006 for (Entry<String, String> e : stringMap.entrySet()) { 1007 1007 tmp.put(e.getKey(), new StringSetting(e.getValue())); … … 1033 1033 */ 1034 1034 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<>(); 1039 1039 1040 1040 if (includeDefaults) { -
trunk/src/org/openstreetmap/josm/data/Preferences.java
r7004 r7005 93 93 * must not have a null value. 94 94 */ 95 protected final SortedMap<String, Setting> settingsMap = new TreeMap< String, Setting>();95 protected final SortedMap<String, Setting> settingsMap = new TreeMap<>(); 96 96 /** 97 97 * Map the setting name to the default value of the setting. … … 99 99 * setting objects can be null. 100 100 */ 101 protected final SortedMap<String, Setting> defaultsMap = new TreeMap< String, Setting>();101 protected final SortedMap<String, Setting> defaultsMap = new TreeMap<>(); 102 102 // 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<>(); 104 104 105 105 /** … … 219 219 */ 220 220 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))); 222 222 } 223 223 @Override public boolean equalVal(List<String> otherVal) { … … 276 276 public static ListListSetting create(Collection<Collection<String>> value) { 277 277 if (value != null) { 278 List<List<String>> valueList = new ArrayList< List<String>>(value.size());278 List<List<String>> valueList = new ArrayList<>(value.size()); 279 279 for (Collection<String> lst : value) { 280 valueList.add(new ArrayList< String>(lst));280 valueList.add(new ArrayList<>(lst)); 281 281 } 282 282 return new ListListSetting(valueList); … … 298 298 if (value == null) return new ListListSetting(null); 299 299 300 List<List<String>> copy = new ArrayList< List<String>>(value.size());300 List<List<String>> copy = new ArrayList<>(value.size()); 301 301 for (Collection<String> lst : value) { 302 List<String> lstCopy = new ArrayList< String>(lst);302 List<String> lstCopy = new ArrayList<>(lst); 303 303 copy.add(Collections.unmodifiableList(lstCopy)); 304 304 } … … 359 359 @Override public MapListSetting copy() { 360 360 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()); 362 362 for (Map<String, String> map : value) { 363 Map<String, String> mapCopy = new LinkedHashMap< String,String>(map);363 Map<String, String> mapCopy = new LinkedHashMap<>(map); 364 364 copy.add(Collections.unmodifiableMap(mapCopy)); 365 365 } … … 435 435 } 436 436 437 private final CopyOnWriteArrayList<PreferenceChangedListener> listeners = new CopyOnWriteArrayList< PreferenceChangedListener>();437 private final CopyOnWriteArrayList<PreferenceChangedListener> listeners = new CopyOnWriteArrayList<>(); 438 438 439 439 public void addPreferenceChangeListener(PreferenceChangedListener listener) { … … 541 541 */ 542 542 public Collection<String> getAllPossiblePreferenceDirs() { 543 LinkedList<String> locations = new LinkedList< String>();543 LinkedList<String> locations = new LinkedList<>(); 544 544 locations.add(getPreferencesDir()); 545 545 String s; … … 594 594 595 595 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<>(); 597 597 for (final Entry<String,Setting> e : settingsMap.entrySet()) { 598 598 if (e.getKey().startsWith(prefix) && (e.getValue() instanceof StringSetting)) { … … 604 604 605 605 public synchronized List<String> getAllPrefixCollectionKeys(final String prefix) { 606 final List<String> all = new LinkedList< String>();606 final List<String> all = new LinkedList<>(); 607 607 for (Map.Entry<String, Setting> entry : settingsMap.entrySet()) { 608 608 if (entry.getKey().startsWith(prefix) && entry.getValue() instanceof ListSetting) { … … 614 614 615 615 public synchronized Map<String, String> getAllColors() { 616 final Map<String,String> all = new TreeMap< String,String>();616 final Map<String,String> all = new TreeMap<>(); 617 617 for (final Entry<String,Setting> e : defaultsMap.entrySet()) { 618 618 if (e.getKey().startsWith("color.") && e.getValue() instanceof StringSetting) { … … 972 972 973 973 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())); 975 975 a.remove(value); 976 976 putCollection(key, a); … … 1059 1059 */ 1060 1060 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())); 1062 1062 for (String i : val) { 1063 1063 if (newCollection.size() >= maxsize) { … … 1089 1089 1090 1090 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(); 1092 1092 } 1093 1093 1094 1094 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))); 1096 1096 } 1097 1097 … … 1124 1124 getListOfStructs(key, def == null ? null : serializeListOfStructs(def, klass)); 1125 1125 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<>(); 1128 1128 for (Map<String,String> entries : prop) { 1129 1129 T struct = deserializeStruct(entries, klass); … … 1153 1153 if (l == null) 1154 1154 return null; 1155 Collection<Map<String,String>> vals = new ArrayList< Map<String,String>>();1155 Collection<Map<String,String>> vals = new ArrayList<>(); 1156 1156 for (T struct : l) { 1157 1157 if (struct == null) { … … 1171 1171 } 1172 1172 1173 Map<String,String> hash = new LinkedHashMap< String,String>();1173 Map<String,String> hash = new LinkedHashMap<>(); 1174 1174 for (Field f : klass.getDeclaredFields()) { 1175 1175 if (f.getAnnotation(pref.class) == null) { … … 1244 1244 1245 1245 public Map<String, Setting> getAllSettings() { 1246 return new TreeMap< String, Setting>(settingsMap);1246 return new TreeMap<>(settingsMap); 1247 1247 } 1248 1248 1249 1249 public Map<String, Setting> getAllDefaults() { 1250 return new TreeMap< String, Setting>(defaultsMap);1250 return new TreeMap<>(defaultsMap); 1251 1251 } 1252 1252 … … 1402 1402 if ("entry".equals(localName)) { 1403 1403 if (entries == null) { 1404 entries = new ArrayList< String>();1404 entries = new ArrayList<>(); 1405 1405 } 1406 1406 entries.add(parser.getAttributeValue(null, "value")); … … 1408 1408 } else if ("list".equals(localName)) { 1409 1409 if (lists == null) { 1410 lists = new ArrayList< List<String>>();1410 lists = new ArrayList<>(); 1411 1411 } 1412 1412 lists.add(parseInnerList()); 1413 1413 } else if ("map".equals(localName)) { 1414 1414 if (maps == null) { 1415 maps = new ArrayList< Map<String, String>>();1415 maps = new ArrayList<>(); 1416 1416 } 1417 1417 maps.add(parseMap()); … … 1441 1441 1442 1442 protected List<String> parseInnerList() throws XMLStreamException { 1443 List<String> entries = new ArrayList< String>();1443 List<String> entries = new ArrayList<>(); 1444 1444 while (true) { 1445 1445 int event = parser.next(); … … 1459 1459 1460 1460 protected Map<String, String> parseMap() throws XMLStreamException { 1461 Map<String, String> map = new LinkedHashMap< String, String>();1461 Map<String, String> map = new LinkedHashMap<>(); 1462 1462 while (true) { 1463 1463 int event = parser.next(); -
trunk/src/org/openstreetmap/josm/data/SystemOfMeasurement.java
r6992 r7005 48 48 public static final Map<String, SystemOfMeasurement> ALL_SYSTEMS; 49 49 static { 50 ALL_SYSTEMS = new LinkedHashMap< String, SystemOfMeasurement>();50 ALL_SYSTEMS = new LinkedHashMap<>(); 51 51 ALL_SYSTEMS.put(marktr("Metric"), METRIC); 52 52 ALL_SYSTEMS.put(marktr("Chinese"), CHINESE); -
trunk/src/org/openstreetmap/josm/data/UndoRedoHandler.java
r6994 r7005 20 20 * All commands that were made on the dataset. Don't write from outside! 21 21 */ 22 public final LinkedList<Command> commands = new LinkedList< Command>();22 public final LinkedList<Command> commands = new LinkedList<>(); 23 23 /** 24 24 * The stack for redoing commands 25 25 */ 26 public final LinkedList<Command> redoCommands = new LinkedList< Command>();26 public final LinkedList<Command> redoCommands = new LinkedList<>(); 27 27 28 private final LinkedList<CommandQueueListener> listenerCommands = new LinkedList< CommandQueueListener>();28 private final LinkedList<CommandQueueListener> listenerCommands = new LinkedList<>(); 29 29 30 30 /** -
trunk/src/org/openstreetmap/josm/data/Version.java
r6990 r7005 75 75 76 76 protected Map<String, String> parseManifestStyleFormattedString(String content) { 77 Map<String, String> properties = new HashMap< String, String>();77 Map<String, String> properties = new HashMap<>(); 78 78 if (content == null) return properties; 79 79 Pattern p = Pattern.compile("^([^:]+):(.*)$"); -
trunk/src/org/openstreetmap/josm/data/conflict/ConflictCollection.java
r6555 r7005 64 64 */ 65 65 public ConflictCollection() { 66 conflicts = new ArrayList< Conflict<? extends OsmPrimitive>>();67 listeners = new CopyOnWriteArrayList< IConflictListener>();66 conflicts = new ArrayList<>(); 67 listeners = new CopyOnWriteArrayList<>(); 68 68 } 69 69 … … 148 148 */ 149 149 public void add(OsmPrimitive my, OsmPrimitive their) { 150 addConflict(new Conflict< OsmPrimitive>(my, their));150 addConflict(new Conflict<>(my, their)); 151 151 fireConflictAdded(); 152 152 } … … 322 322 */ 323 323 public Set<OsmPrimitive> getMyConflictParties() { 324 HashSet<OsmPrimitive> ret = new HashSet< OsmPrimitive>();324 HashSet<OsmPrimitive> ret = new HashSet<>(); 325 325 for (Conflict<?> c: conflicts) { 326 326 ret.add(c.getMy()); … … 336 336 */ 337 337 public Set<OsmPrimitive> getTheirConflictParties() { 338 HashSet<OsmPrimitive> ret = new HashSet< OsmPrimitive>();338 HashSet<OsmPrimitive> ret = new HashSet<>(); 339 339 for (Conflict<?> c: conflicts) { 340 340 ret.add(c.getTheir()); -
trunk/src/org/openstreetmap/josm/data/gpx/GpxData.java
r6830 r7005 26 26 public String creator; 27 27 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<>(); 31 31 32 32 @SuppressWarnings("unchecked") -
trunk/src/org/openstreetmap/josm/data/gpx/GpxRoute.java
r6380 r7005 6 6 7 7 public class GpxRoute extends WithAttributes { 8 public Collection<WayPoint> routePoints = new LinkedList< WayPoint>();8 public Collection<WayPoint> routePoints = new LinkedList<>(); 9 9 } -
trunk/src/org/openstreetmap/josm/data/gpx/ImmutableGpxTrack.java
r5681 r7005 18 18 19 19 public ImmutableGpxTrack(Collection<Collection<WayPoint>> trackSegs, Map<String, Object> attributes) { 20 List<GpxTrackSegment> newSegments = new ArrayList< GpxTrackSegment>();20 List<GpxTrackSegment> newSegments = new ArrayList<>(); 21 21 for (Collection<WayPoint> trackSeg: trackSegs) { 22 22 if (trackSeg != null && !trackSeg.isEmpty()) { … … 24 24 } 25 25 } 26 this.attr = Collections.unmodifiableMap(new HashMap< String, Object>(attributes));26 this.attr = Collections.unmodifiableMap(new HashMap<>(attributes)); 27 27 this.segments = Collections.unmodifiableCollection(newSegments); 28 28 this.length = calculateLength(); -
trunk/src/org/openstreetmap/josm/data/gpx/ImmutableGpxTrackSegment.java
r6084 r7005 15 15 16 16 public ImmutableGpxTrackSegment(Collection<WayPoint> wayPoints) { 17 this.wayPoints = Collections.unmodifiableCollection(new ArrayList< WayPoint>(wayPoints));17 this.wayPoints = Collections.unmodifiableCollection(new ArrayList<>(wayPoints)); 18 18 this.bounds = calculateBounds(); 19 19 this.length = calculateLength(); -
trunk/src/org/openstreetmap/josm/data/gpx/WayPoint.java
r6895 r7005 137 137 @Override 138 138 public List<String> getTemplateKeys() { 139 return new ArrayList< String>(attr.keySet());139 return new ArrayList<>(attr.keySet()); 140 140 } 141 141 } -
trunk/src/org/openstreetmap/josm/data/gpx/WithAttributes.java
r6830 r7005 19 19 * The "attr" hash is used to store the XML payload (not only XML attributes!) 20 20 */ 21 public Map<String, Object> attr = new HashMap< String, Object>(0);21 public Map<String, Object> attr = new HashMap<>(0); 22 22 23 23 /** -
trunk/src/org/openstreetmap/josm/data/imagery/GeorefImage.java
r6296 r7005 169 169 img.getGraphics().dispose(); 170 170 g.drawImage(img, x, y, null); 171 reImg = new SoftReference< BufferedImage>(img);171 reImg = new SoftReference<>(img); 172 172 } 173 173 } catch(Exception e) { -
trunk/src/org/openstreetmap/josm/data/imagery/ImageryInfo.java
r6990 r7005 95 95 } 96 96 97 private List<Shape> shapes = new ArrayList< Shape>();97 private List<Shape> shapes = new ArrayList<>(); 98 98 99 99 /** … … 546 546 if (serverProjections == null || serverProjections.isEmpty()) { 547 547 try { 548 serverProjections = new ArrayList< String>();548 serverProjections = new ArrayList<>(); 549 549 Matcher m = Pattern.compile(".*\\{PROJ\\(([^)}]+)\\)\\}.*").matcher(url.toUpperCase()); 550 550 if(m.matches()) { … … 710 710 711 711 public void setServerProjections(Collection<String> serverProjections) { 712 this.serverProjections = new ArrayList< String>(serverProjections);712 this.serverProjections = new ArrayList<>(serverProjections); 713 713 } 714 714 -
trunk/src/org/openstreetmap/josm/data/imagery/ImageryLayerInfo.java
r6897 r7005 22 22 23 23 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<>(); 26 26 27 27 private static final String[] DEFAULT_LAYER_SITES = { … … 92 92 93 93 Collection<String> defaults = Main.pref.getCollection("imagery.layers.default"); 94 List<String> defaultsSave = new ArrayList< String>();94 List<String> defaultsSave = new ArrayList<>(); 95 95 for (ImageryInfo def : defaultLayers) { 96 96 if (def.isDefaultEntry()) { … … 137 137 138 138 public void save() { 139 List<ImageryPreferenceEntry> entries = new ArrayList< ImageryPreferenceEntry>();139 List<ImageryPreferenceEntry> entries = new ArrayList<>(); 140 140 for (ImageryInfo info : layers) { 141 141 entries.add(new ImageryPreferenceEntry(info)); -
trunk/src/org/openstreetmap/josm/data/imagery/OffsetBookmark.java
r6316 r7005 16 16 17 17 public class OffsetBookmark { 18 public static final List<OffsetBookmark> allBookmarks = new ArrayList< OffsetBookmark>();18 public static final List<OffsetBookmark> allBookmarks = new ArrayList<>(); 19 19 20 20 public String projectionCode; … … 45 45 46 46 public OffsetBookmark(Collection<String> list) { 47 List<String> array = new ArrayList< String>(list);47 List<String> array = new ArrayList<>(list); 48 48 this.projectionCode = array.get(0); 49 49 this.layerName = array.get(1); … … 61 61 62 62 public List<String> getInfoArray() { 63 List<String> res = new ArrayList< String>(7);63 List<String> res = new ArrayList<>(7); 64 64 if (projectionCode != null) { 65 65 res.add(projectionCode); … … 86 86 87 87 public static void saveBookmarks() { 88 LinkedList<Collection<String>> coll = new LinkedList< Collection<String>>();88 LinkedList<Collection<String>> coll = new LinkedList<>(); 89 89 for (OffsetBookmark b : allBookmarks) { 90 90 coll.add(b.getInfoArray()); -
trunk/src/org/openstreetmap/josm/data/imagery/Shape.java
r6822 r7005 20 20 public class Shape { 21 21 22 private List<Coordinate> coords = new ArrayList< Coordinate>();22 private List<Coordinate> coords = new ArrayList<>(); 23 23 24 24 public Shape(String asString, String separator) throws IllegalArgumentException { … … 53 53 if (latlon == null) 54 54 return false; 55 List<Node> nodes = new ArrayList< Node>(coords.size());55 List<Node> nodes = new ArrayList<>(coords.size()); 56 56 for (Coordinate c : coords) { 57 57 nodes.add(new Node(new LatLon(c.getLat(), c.getLon()))); -
trunk/src/org/openstreetmap/josm/data/imagery/WmsCache.java
r6992 r7005 76 76 final String projection; 77 77 final String cacheDirectory; 78 final List<CacheEntry> entries = new ArrayList< WmsCache.CacheEntry>();78 final List<CacheEntry> entries = new ArrayList<>(); 79 79 80 80 ProjectionEntries(String projection, String cacheDirectory) { … … 84 84 } 85 85 86 private final Map<String, ProjectionEntries> entries = new HashMap< String, ProjectionEntries>();86 private final Map<String, ProjectionEntries> entries = new HashMap<>(); 87 87 private final File cacheDir; 88 88 private final int tileSize; // Should be always 500 … … 90 90 private boolean totalFileSizeDirty; // Some file was missing - size needs to be recalculated 91 91 // 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<>(); 93 93 private Set<ProjectionBounds> areaToCache; 94 94 … … 210 210 private void removeNonReferencedFiles() { 211 211 212 Set<String> usedProjections = new HashSet< String>();212 Set<String> usedProjections = new HashSet<>(); 213 213 214 214 for (ProjectionEntries projectionEntries: entries.values()) { … … 218 218 File projectionDir = new File(cacheDir, projectionEntries.cacheDirectory); 219 219 if (projectionDir.exists()) { 220 Set<String> referencedFiles = new HashSet< String>();220 Set<String> referencedFiles = new HashSet<>(); 221 221 222 222 for (CacheEntry ce: projectionEntries.entries) { … … 373 373 List<CacheEntry> matches; 374 374 synchronized (this) { 375 matches = new ArrayList< WmsCache.CacheEntry>();375 matches = new ArrayList<>(); 376 376 377 377 double minPPD = pixelPerDegree / 5; … … 410 410 411 411 boolean drawAtLeastOnce = false; 412 Map<CacheEntry, SoftReference<BufferedImage>> localCache = new HashMap< WmsCache.CacheEntry, SoftReference<BufferedImage>>();412 Map<CacheEntry, SoftReference<BufferedImage>> localCache = new HashMap<>(); 413 413 for (CacheEntry ce: matches) { 414 414 BufferedImage img; 415 415 try { 416 416 img = loadImage(projectionEntries, ce); 417 localCache.put(ce, new SoftReference< BufferedImage>(img));417 localCache.put(ce, new SoftReference<>(img)); 418 418 } catch (IOException e) { 419 419 continue; -
trunk/src/org/openstreetmap/josm/data/imagery/types/ProjectionType.java
r6897 r7005 71 71 public List<EntryType> getEntry() { 72 72 if (entry == null) { 73 entry = new ArrayList< EntryType>();73 entry = new ArrayList<>(); 74 74 } 75 75 return this.entry; -
trunk/src/org/openstreetmap/josm/data/imagery/types/WmsCacheType.java
r6897 r7005 73 73 public List<ProjectionType> getProjection() { 74 74 if (projection == null) { 75 projection = new ArrayList< ProjectionType>();75 projection = new ArrayList<>(); 76 76 } 77 77 return this.projection; -
trunk/src/org/openstreetmap/josm/data/osm/AbstractPrimitive.java
r6889 r7005 471 471 @Override 472 472 public Map<String, String> getKeys() { 473 Map<String, String> result = new HashMap< String, String>();473 Map<String, String> result = new HashMap<>(); 474 474 String[] keys = this.keys; 475 475 if (keys != null) { … … 638 638 if (keys == null) 639 639 return Collections.emptySet(); 640 Set<String> result = new HashSet< String>(keys.length / 2);640 Set<String> result = new HashSet<>(keys.length / 2); 641 641 for (int i=0; i<keys.length; i+=2) { 642 642 result.add(keys[i]); -
trunk/src/org/openstreetmap/josm/data/osm/Changeset.java
r6830 r7005 59 59 this.id = id; 60 60 this.incomplete = id > 0; 61 this.tags = new HashMap< String, String>();61 this.tags = new HashMap<>(); 62 62 } 63 63 … … 70 70 if (other == null) { 71 71 this.id = 0; 72 this.tags = new HashMap< String, String>();72 this.tags = new HashMap<>(); 73 73 } else if (other.isIncomplete()) { 74 74 setId(other.getId()); 75 75 this.incomplete = true; 76 this.tags = new HashMap< String, String>();76 this.tags = new HashMap<>(); 77 77 } else { 78 78 this.id = other.id; … … 286 286 this.min = other.min; 287 287 this.max = other.max; 288 this.tags = new HashMap< String, String>(other.tags);288 this.tags = new HashMap<>(other.tags); 289 289 this.incomplete = other.incomplete; 290 290 -
trunk/src/org/openstreetmap/josm/data/osm/ChangesetCache.java
r6990 r7005 46 46 47 47 /** the cached changesets */ 48 private final Map<Integer, Changeset> cache = new HashMap< Integer, Changeset>();48 private final Map<Integer, Changeset> cache = new HashMap<>(); 49 49 50 50 private final CopyOnWriteArrayList<ChangesetCacheListener> listeners = 51 new CopyOnWriteArrayList< ChangesetCacheListener>();51 new CopyOnWriteArrayList<>(); 52 52 53 53 private ChangesetCache() { … … 117 117 118 118 public Set<Changeset> getChangesets() { 119 return new HashSet< Changeset>(cache.values());119 return new HashSet<>(cache.values()); 120 120 } 121 121 … … 180 180 */ 181 181 public List<Changeset> getOpenChangesets() { 182 List<Changeset> ret = new ArrayList< Changeset>();182 List<Changeset> ret = new ArrayList<>(); 183 183 for (Changeset cs: cache.values()) { 184 184 if (cs.isOpen()) { -
trunk/src/org/openstreetmap/josm/data/osm/ChangesetDataSet.java
r6889 r7005 28 28 } 29 29 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<>(); 32 32 33 33 /** … … 116 116 public Set<HistoryOsmPrimitive> getPrimitivesByModificationType(ChangesetModificationType cmt) throws IllegalArgumentException { 117 117 CheckParameterUtil.ensureParameterNotNull(cmt,"cmt"); 118 HashSet<HistoryOsmPrimitive> ret = new HashSet< HistoryOsmPrimitive>();118 HashSet<HistoryOsmPrimitive> ret = new HashSet<>(); 119 119 for (Entry<PrimitiveId, ChangesetModificationType> entry: modificationTypes.entrySet()) { 120 120 if (entry.getValue().equals(cmt)) { -
trunk/src/org/openstreetmap/josm/data/osm/DataSet.java
r6920 r7005 102 102 private static final int MAX_EVENTS = 1000; 103 103 104 private Storage<OsmPrimitive> allPrimitives = new Storage< OsmPrimitive>(new Storage.PrimitiveIdHash(), true);104 private Storage<OsmPrimitive> allPrimitives = new Storage<>(new Storage.PrimitiveIdHash(), true); 105 105 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<>(); 107 107 108 108 // 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<>(); 111 111 112 112 // Number of open calls to beginUpdate 113 113 private int updateCount; 114 114 // 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<>(); 116 116 117 117 private int highlightUpdateCount; … … 146 146 * History of selections - shared by plugins and SelectionListDialog 147 147 */ 148 private final LinkedList<Collection<? extends OsmPrimitive>> selectionHistory = new LinkedList< Collection<? extends OsmPrimitive>>();148 private final LinkedList<Collection<? extends OsmPrimitive>> selectionHistory = new LinkedList<>(); 149 149 150 150 /** … … 211 211 * Holding bin for changeset tag information, to be applied when or if this is ever uploaded. 212 212 */ 213 private Map<String, String> changeSetTags = new HashMap< String, String>();213 private Map<String, String> changeSetTags = new HashMap<>(); 214 214 215 215 public Map<String, String> getChangeSetTags() { … … 225 225 * conversion of the whole DataSet by iterating over this data structure. 226 226 */ 227 private QuadBuckets<Node> nodes = new QuadBuckets< Node>();227 private QuadBuckets<Node> nodes = new QuadBuckets<>(); 228 228 229 229 private <T extends OsmPrimitive> Collection<T> getPrimitives(Predicate<OsmPrimitive> predicate) { 230 return new SubclassFilteredCollection< OsmPrimitive, T>(allPrimitives, predicate);230 return new SubclassFilteredCollection<>(allPrimitives, predicate); 231 231 } 232 232 … … 254 254 * The way nodes are stored only in the way list. 255 255 */ 256 private QuadBuckets<Way> ways = new QuadBuckets< Way>();256 private QuadBuckets<Way> ways = new QuadBuckets<>(); 257 257 258 258 /** … … 277 277 * All relations/relationships 278 278 */ 279 private Collection<Relation> relations = new ArrayList< Relation>();279 private Collection<Relation> relations = new ArrayList<>(); 280 280 281 281 /** … … 292 292 try { 293 293 // 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<>(); 295 295 for (Relation r: relations) { 296 296 if (r.getBBox().intersects(bbox)) { … … 307 307 * All data sources of this DataSet. 308 308 */ 309 public final Collection<DataSource> dataSources = new LinkedList< DataSource>();309 public final Collection<DataSource> dataSources = new LinkedList<>(); 310 310 311 311 /** … … 412 412 * dataset. (However, the selection does only change in the active layer) 413 413 */ 414 private static final Collection<SelectionChangedListener> selListeners = new CopyOnWriteArrayList< SelectionChangedListener>();414 private static final Collection<SelectionChangedListener> selListeners = new CopyOnWriteArrayList<>(); 415 415 416 416 public static void addSelectionListener(SelectionChangedListener listener) { … … 434 434 } 435 435 436 private Set<OsmPrimitive> selectedPrimitives = new LinkedHashSet< OsmPrimitive>();436 private Set<OsmPrimitive> selectedPrimitives = new LinkedHashSet<>(); 437 437 private Collection<OsmPrimitive> selectionSnapshot; 438 438 439 439 public Collection<OsmPrimitive> getSelectedNodesAndWays() { 440 return new FilteredCollection< OsmPrimitive>(getSelected(), new Predicate<OsmPrimitive>() {440 return new FilteredCollection<>(getSelected(), new Predicate<OsmPrimitive>() { 441 441 @Override 442 442 public boolean evaluate(OsmPrimitive primitive) { … … 474 474 */ 475 475 public Collection<OsmPrimitive> getSelected() { 476 return new SubclassFilteredCollection< OsmPrimitive, OsmPrimitive>(getAllSelected(), OsmPrimitive.nonDeletedPredicate);476 return new SubclassFilteredCollection<>(getAllSelected(), OsmPrimitive.nonDeletedPredicate); 477 477 } 478 478 … … 487 487 synchronized (selectionLock) { 488 488 if (selectionSnapshot == null) { 489 selectionSnapshot = Collections.unmodifiableList(new ArrayList< OsmPrimitive>(selectedPrimitives));489 selectionSnapshot = Collections.unmodifiableList(new ArrayList<>(selectedPrimitives)); 490 490 } 491 491 currentList = selectionSnapshot; … … 498 498 */ 499 499 public Collection<Node> getSelectedNodes() { 500 return new SubclassFilteredCollection< OsmPrimitive, Node>(getSelected(), OsmPrimitive.nodePredicate);500 return new SubclassFilteredCollection<>(getSelected(), OsmPrimitive.nodePredicate); 501 501 } 502 502 … … 505 505 */ 506 506 public Collection<Way> getSelectedWays() { 507 return new SubclassFilteredCollection< OsmPrimitive, Way>(getSelected(), OsmPrimitive.wayPredicate);507 return new SubclassFilteredCollection<>(getSelected(), OsmPrimitive.wayPredicate); 508 508 } 509 509 … … 512 512 */ 513 513 public Collection<Relation> getSelectedRelations() { 514 return new SubclassFilteredCollection< OsmPrimitive, Relation>(getSelected(), OsmPrimitive.relationPredicate);514 return new SubclassFilteredCollection<>(getSelected(), OsmPrimitive.relationPredicate); 515 515 } 516 516 … … 592 592 boolean changed; 593 593 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<>(); 596 596 addSelected(selection, false); 597 597 changed = !oldSelection.equals(selectedPrimitives); … … 719 719 try { 720 720 DataSet ds = new DataSet(); 721 HashMap<OsmPrimitive, OsmPrimitive> primMap = new HashMap< OsmPrimitive, OsmPrimitive>();721 HashMap<OsmPrimitive, OsmPrimitive> primMap = new HashMap<>(); 722 722 for (Node n : nodes) { 723 723 Node newNode = new Node(n); … … 728 728 Way newWay = new Way(w); 729 729 primMap.put(w, newWay); 730 List<Node> newNodes = new ArrayList< Node>();730 List<Node> newNodes = new ArrayList<>(); 731 731 for (Node n: w.getNodes()) { 732 732 newNodes.add((Node)primMap.get(n)); … … 745 745 for (Relation r : relations) { 746 746 Relation newRelation = (Relation)primMap.get(r); 747 List<RelationMember> newMembers = new ArrayList< RelationMember>();747 List<RelationMember> newMembers = new ArrayList<>(); 748 748 for (RelationMember rm: r.getMembers()) { 749 749 newMembers.add(new RelationMember(rm.getRole(), primMap.get(rm.getMember()))); … … 821 821 */ 822 822 public Set<Way> unlinkNodeFromWays(Node node) { 823 Set<Way> result = new HashSet< Way>();823 Set<Way> result = new HashSet<>(); 824 824 beginUpdate(); 825 825 try { … … 848 848 */ 849 849 public Set<Relation> unlinkPrimitiveFromRelations(OsmPrimitive primitive) { 850 Set<Relation> result = new HashSet< Relation>();850 Set<Relation> result = new HashSet<>(); 851 851 beginUpdate(); 852 852 try { … … 882 882 */ 883 883 public Set<OsmPrimitive> unlinkReferencesToPrimitive(OsmPrimitive referencedPrimitive) { 884 Set<OsmPrimitive> result = new HashSet< OsmPrimitive>();884 Set<OsmPrimitive> result = new HashSet<>(); 885 885 beginUpdate(); 886 886 try { … … 983 983 updateCount--; 984 984 if (updateCount == 0) { 985 List<AbstractDatasetChangedEvent> eventsCopy = new ArrayList< AbstractDatasetChangedEvent>(cachedEvents);985 List<AbstractDatasetChangedEvent> eventsCopy = new ArrayList<>(cachedEvents); 986 986 cachedEvents.clear(); 987 987 lock.writeLock().unlock(); … … 1159 1159 */ 1160 1160 public List<Bounds> getDataSourceBounds() { 1161 List<Bounds> ret = new ArrayList< Bounds>(dataSources.size());1161 List<Bounds> ret = new ArrayList<>(dataSources.size()); 1162 1162 for (DataSource ds : dataSources) { 1163 1163 if (ds.bounds != null) { -
trunk/src/org/openstreetmap/josm/data/osm/DataSetMerger.java
r6881 r7005 59 59 this.sourceDataSet = sourceDataSet; 60 60 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<>(); 64 64 } 65 65 … … 137 137 138 138 protected void addConflict(OsmPrimitive my, OsmPrimitive their) { 139 addConflict(new Conflict< OsmPrimitive>(my, their));139 addConflict(new Conflict<>(my, their)); 140 140 } 141 141 … … 238 238 throw new IllegalStateException(tr("Missing merge target for way with id {0}", source.getUniqueId())); 239 239 240 List<Node> newNodes = new ArrayList< Node>(source.getNodesCount());240 List<Node> newNodes = new ArrayList<>(source.getNodesCount()); 241 241 for (Node sourceNode : source.getNodes()) { 242 242 Node targetNode = (Node)getMergeTarget(sourceNode); … … 264 264 if (target == null) 265 265 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<>(); 267 267 for (RelationMember sourceMember : source.getMembers()) { 268 268 OsmPrimitive targetMember = getMergeTarget(sourceMember.getMember()); … … 272 272 newMembers.add(newMember); 273 273 if (targetMember.isDeleted() && !conflicts.hasConflictForMy(targetMember)) { 274 addConflict(new Conflict< OsmPrimitive>(targetMember, sourceMember.getMember(), true));274 addConflict(new Conflict<>(targetMember, sourceMember.getMember(), true)); 275 275 targetMember.setDeleted(false); 276 276 } … … 326 326 for (OsmPrimitive referrer: source.getReferrers()) { 327 327 if (targetDataSet.getPrimitiveById(referrer.getPrimitiveId()) == null) { 328 addConflict(new Conflict< OsmPrimitive>(target, source, true));328 addConflict(new Conflict<>(target, source, true)); 329 329 target.setDeleted(false); 330 330 break; … … 403 403 targetDataSet.beginUpdate(); 404 404 try { 405 List<? extends OsmPrimitive> candidates = new ArrayList< Node>(targetDataSet.getNodes());405 List<? extends OsmPrimitive> candidates = new ArrayList<>(targetDataSet.getNodes()); 406 406 for (Node node: sourceDataSet.getNodes()) { 407 407 mergePrimitive(node, candidates); … … 411 411 } 412 412 candidates.clear(); 413 candidates = new ArrayList< Way>(targetDataSet.getWays());413 candidates = new ArrayList<>(targetDataSet.getWays()); 414 414 for (Way way: sourceDataSet.getWays()) { 415 415 mergePrimitive(way, candidates); … … 419 419 } 420 420 candidates.clear(); 421 candidates = new ArrayList< Relation>(targetDataSet.getRelations());421 candidates = new ArrayList<>(targetDataSet.getRelations()); 422 422 for (Relation relation: sourceDataSet.getRelations()) { 423 423 mergePrimitive(relation, candidates); -
trunk/src/org/openstreetmap/josm/data/osm/DefaultChangesetCacheEvent.java
r6084 r7005 16 16 public DefaultChangesetCacheEvent(ChangesetCache source) { 17 17 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<>(); 21 21 } 22 22 -
trunk/src/org/openstreetmap/josm/data/osm/FilterMatcher.java
r5909 r7005 90 90 } 91 91 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<>(); 94 94 95 95 public void update(Collection<Filter> filters) throws ParseError { -
trunk/src/org/openstreetmap/josm/data/osm/MultipolygonCreate.java
r6841 r7005 49 49 */ 50 50 private List<Node> getNodes() { 51 List<Node> nodes = new ArrayList< Node>();51 List<Node> nodes = new ArrayList<>(); 52 52 53 53 for(int waypos = 0; waypos < this.ways.size(); waypos ++) { … … 85 85 this.outerWay = _pol; 86 86 this.level = _level; 87 this.innerWays = new ArrayList< JoinedPolygon>();87 this.innerWays = new ArrayList<>(); 88 88 } 89 89 } … … 98 98 99 99 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); 102 102 } 103 103 … … 109 109 */ 110 110 public String makeFromWays(Collection<Way> ways){ 111 List<JoinedPolygon> joinedWays = new ArrayList< JoinedPolygon>();111 List<JoinedPolygon> joinedWays = new ArrayList<>(); 112 112 113 113 //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<>(); 116 116 117 117 for(Way w: ways) { … … 139 139 140 140 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<>(); 143 143 Way curWay = startWay; 144 144 Node prevNode = startNode; … … 197 197 } 198 198 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); 201 201 202 202 //take every other level … … 221 221 222 222 //TODO: bad performance for deep nesting... 223 List<PolygonLevel> result = new ArrayList< PolygonLevel>();223 List<PolygonLevel> result = new ArrayList<>(); 224 224 225 225 for (JoinedPolygon outerWay : boundaryWays) { 226 226 227 227 boolean outerGood = true; 228 List<JoinedPolygon> innerCandidates = new ArrayList< JoinedPolygon>();228 List<JoinedPolygon> innerCandidates = new ArrayList<>(); 229 229 230 230 for (JoinedPolygon innerWay : boundaryWays) { -
trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java
r6890 r7005 121 121 public static <T extends OsmPrimitive> List<T> getFilteredList(Collection<OsmPrimitive> list, Class<T> type) { 122 122 if (list == null) return Collections.emptyList(); 123 List<T> ret = new LinkedList< T>();123 List<T> ret = new LinkedList<>(); 124 124 for(OsmPrimitive p: list) { 125 125 if (type.isInstance(p)) { … … 142 142 */ 143 143 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<>(); 145 145 if (set != null) { 146 146 for(OsmPrimitive p: set) { … … 161 161 */ 162 162 public static Set<OsmPrimitive> getReferrer(Collection<? extends OsmPrimitive> primitives) { 163 HashSet<OsmPrimitive> ret = new HashSet< OsmPrimitive>();163 HashSet<OsmPrimitive> ret = new HashSet<>(); 164 164 if (primitives == null || primitives.isEmpty()) return ret; 165 165 for (OsmPrimitive p: primitives) { … … 632 632 public static Collection<String> getUninterestingKeys() { 633 633 if (uninteresting == null) { 634 LinkedList<String> l = new LinkedList< String>(Arrays.asList(634 LinkedList<String> l = new LinkedList<>(Arrays.asList( 635 635 "source", "source_ref", "source:", "comment", 636 636 "converted_by", "watch", "watch:", … … 731 731 */ 732 732 public Map<String, String> getInterestingTags() { 733 Map<String, String> result = new HashMap< String, String>();733 Map<String, String> result = new HashMap<>(); 734 734 String[] keys = this.keys; 735 735 if (keys != null) { … … 997 997 checkDataset(); 998 998 Object referrers = this.referrers; 999 List<OsmPrimitive> result = new ArrayList< OsmPrimitive>();999 List<OsmPrimitive> result = new ArrayList<>(); 1000 1000 if (referrers != null) { 1001 1001 if (referrers instanceof OsmPrimitive) { … … 1298 1298 public Collection<String> getTemplateKeys() { 1299 1299 Collection<String> keySet = keySet(); 1300 List<String> result = new ArrayList< String>(keySet.size() + 2);1300 List<String> result = new ArrayList<>(keySet.size() + 2); 1301 1301 result.add(SPECIAL_VALUE_ID); 1302 1302 result.add(SPECIAL_VALUE_LOCAL_NAME); … … 1331 1331 */ 1332 1332 public static Set<Relation> getParentRelations(Collection<? extends OsmPrimitive> primitives) { 1333 HashSet<Relation> ret = new HashSet< Relation>();1333 HashSet<Relation> ret = new HashSet<>(); 1334 1334 for (OsmPrimitive w : primitives) { 1335 1335 ret.addAll(OsmPrimitive.getFilteredList(w.getReferrers(), Relation.class)); -
trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitiveComparator.java
r6889 r7005 10 10 /** Comparator, comparing by type and objects display names */ 11 11 public 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<>(); 13 13 private final DefaultNameFormatter df = DefaultNameFormatter.getInstance(); 14 14 public boolean relationsFirst = false; -
trunk/src/org/openstreetmap/josm/data/osm/OsmUtils.java
r6792 r7005 13 13 } 14 14 15 static final List<String> TRUE_VALUES = new ArrayList< String>(Arrays15 static final List<String> TRUE_VALUES = new ArrayList<>(Arrays 16 16 .asList(new String[] { "true", "yes", "1", "on" })); 17 static final List<String> FALSE_VALUES = new ArrayList< String>(Arrays17 static final List<String> FALSE_VALUES = new ArrayList<>(Arrays 18 18 .asList(new String[] { "false", "no", "0", "off" })); 19 static final List<String> REVERSE_VALUES = new ArrayList< String>(Arrays19 static final List<String> REVERSE_VALUES = new ArrayList<>(Arrays 20 20 .asList(new String[] { "reverse", "-1" })); 21 21 -
trunk/src/org/openstreetmap/josm/data/osm/PrimitiveData.java
r6889 r7005 55 55 @SuppressWarnings("unchecked") 56 56 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<>(); 58 58 for(PrimitiveData p: list) { 59 59 if (type.getDataClass().isInstance(p)) { -
trunk/src/org/openstreetmap/josm/data/osm/PrimitiveDeepCopy.java
r6890 r7005 22 22 } 23 23 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<>(); 27 27 28 28 public PrimitiveDeepCopy() { … … 42 42 referenced.clear(); 43 43 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<>(); 47 47 48 48 new AbstractVisitor() { … … 96 96 97 97 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()); 99 99 result.addAll(directlyAdded); 100 100 result.addAll(referenced); -
trunk/src/org/openstreetmap/josm/data/osm/QuadBuckets.java
r6890 r7005 50 50 case NE_INDEX: 51 51 if (ne == null) { 52 ne = new QBLevel< T>(this, index, buckets);52 ne = new QBLevel<>(this, index, buckets); 53 53 } 54 54 return ne; 55 55 case NW_INDEX: 56 56 if (nw == null) { 57 nw = new QBLevel< T>(this, index, buckets);57 nw = new QBLevel<>(this, index, buckets); 58 58 } 59 59 return nw; 60 60 case SE_INDEX: 61 61 if (se == null) { 62 se = new QBLevel< T>(this, index, buckets);62 se = new QBLevel<>(this, index, buckets); 63 63 } 64 64 return se; 65 65 case SW_INDEX: 66 66 if (sw == null) { 67 sw = new QBLevel< T>(this, index, buckets);67 sw = new QBLevel<>(this, index, buckets); 68 68 } 69 69 return sw; … … 174 174 // The split_lock will keep two concurrent calls from overwriting content 175 175 if (content == null) { 176 content = new ArrayList< T>();176 content = new ArrayList<>(); 177 177 } 178 178 ret = content.add(o); … … 405 405 @Override 406 406 public final void clear() { 407 root = new QBLevel< T>(this);407 root = new QBLevel<>(this); 408 408 search_cache = null; 409 409 size = 0; … … 478 478 479 479 public ArrayList<T> toArrayList() { 480 ArrayList<T> a = new ArrayList< T>();480 ArrayList<T> a = new ArrayList<>(); 481 481 for (T n : this) { 482 482 a.add(n); … … 581 581 582 582 public List<T> search(BBox search_bbox) { 583 List<T> ret = new ArrayList< T>();583 List<T> ret = new ArrayList<>(); 584 584 // Doing this cuts down search cost on a real-life data set by about 25% 585 585 boolean cache_searches = true; -
trunk/src/org/openstreetmap/josm/data/osm/Relation.java
r6830 r7005 35 35 */ 36 36 public List<RelationMember> getMembers() { 37 return new CopyList< RelationMember>(members);37 return new CopyList<>(members); 38 38 } 39 39 … … 241 241 RelationData relationData = (RelationData) data; 242 242 243 List<RelationMember> newMembers = new ArrayList< RelationMember>();243 List<RelationMember> newMembers = new ArrayList<>(); 244 244 for (RelationMemberData member : relationData.getMembers()) { 245 245 OsmPrimitive primitive = getDataSet().getPrimitiveById(member); … … 384 384 */ 385 385 public Set<OsmPrimitive> getMemberPrimitives() { 386 HashSet<OsmPrimitive> ret = new HashSet< OsmPrimitive>();386 HashSet<OsmPrimitive> ret = new HashSet<>(); 387 387 RelationMember[] members = this.members; 388 388 for (RelationMember m: members) { … … 521 521 */ 522 522 public Collection<OsmPrimitive> getIncompleteMembers() { 523 Set<OsmPrimitive> ret = new HashSet< OsmPrimitive>();523 Set<OsmPrimitive> ret = new HashSet<>(); 524 524 RelationMember[] members = this.members; 525 525 for (RelationMember rm: members) { -
trunk/src/org/openstreetmap/josm/data/osm/RelationData.java
r6009 r7005 9 9 public class RelationData extends PrimitiveData implements IRelation { 10 10 11 private List<RelationMemberData> members = new ArrayList< RelationMemberData>();11 private List<RelationMemberData> members = new ArrayList<>(); 12 12 13 13 public RelationData() { … … 25 25 26 26 public void setMembers(List<RelationMemberData> memberData) { 27 members = new ArrayList< RelationMemberData>(memberData);27 members = new ArrayList<>(memberData); 28 28 } 29 29 -
trunk/src/org/openstreetmap/josm/data/osm/RelationToChildReference.java
r6889 r7005 16 16 public static Set<RelationToChildReference> getRelationToChildReferences(OsmPrimitive child) { 17 17 Set<Relation> parents = OsmPrimitive.getFilteredSet(child.getReferrers(), Relation.class); 18 Set<RelationToChildReference> references = new HashSet< RelationToChildReference>();18 Set<RelationToChildReference> references = new HashSet<>(); 19 19 for (Relation parent: parents) { 20 20 for (int i=0; i < parent.getMembersCount(); i++) { … … 35 35 */ 36 36 public static Set<RelationToChildReference> getRelationToChildReferences(Collection<? extends OsmPrimitive> children) { 37 Set<RelationToChildReference> references = new HashSet< RelationToChildReference>();37 Set<RelationToChildReference> references = new HashSet<>(); 38 38 for (OsmPrimitive child: children) { 39 39 references.addAll(getRelationToChildReferences(child)); -
trunk/src/org/openstreetmap/josm/data/osm/SimplePrimitiveId.java
r6674 r7005 94 94 */ 95 95 public static List<SimplePrimitiveId> fuzzyParse(String s) { 96 final ArrayList<SimplePrimitiveId> ids = new ArrayList< SimplePrimitiveId>();96 final ArrayList<SimplePrimitiveId> ids = new ArrayList<>(); 97 97 final Matcher m = ID_PATTERN.matcher(s); 98 98 while (m.find()) { -
trunk/src/org/openstreetmap/josm/data/osm/Storage.java
r6830 r7005 257 257 258 258 public <K> Map<K,T> foreignKey(Hash<K,? super T> h) { 259 return new FMap< K>(h);259 return new FMap<>(h); 260 260 } 261 261 -
trunk/src/org/openstreetmap/josm/data/osm/TagCollection.java
r6890 r7005 141 141 } 142 142 143 private final Set<Tag> tags = new HashSet< Tag>();143 private final Set<Tag> tags = new HashSet<>(); 144 144 145 145 /** … … 469 469 */ 470 470 public Set<Tag> asSet() { 471 return new HashSet< Tag>(tags);471 return new HashSet<>(tags); 472 472 } 473 473 … … 479 479 */ 480 480 public List<Tag> asList() { 481 return new ArrayList< Tag>(tags);481 return new ArrayList<>(tags); 482 482 } 483 483 … … 498 498 */ 499 499 public Set<String> getKeys() { 500 HashSet<String> ret = new HashSet< String>();500 HashSet<String> ret = new HashSet<>(); 501 501 for (Tag tag: tags) { 502 502 ret.add(tag.getKey()); … … 511 511 */ 512 512 public Set<String> getKeysWithMultipleValues() { 513 HashMap<String, Integer> counters = new HashMap< String, Integer>();513 HashMap<String, Integer> counters = new HashMap<>(); 514 514 for (Tag tag: tags) { 515 515 Integer v = counters.get(tag.getKey()); 516 516 counters.put(tag.getKey(),(v==null) ? 1 : v+1); 517 517 } 518 Set<String> ret = new HashSet< String>();518 Set<String> ret = new HashSet<>(); 519 519 for (Entry<String, Integer> e : counters.entrySet()) { 520 520 if (e.getValue() > 1) { … … 556 556 */ 557 557 public Set<String> getValues() { 558 HashSet<String> ret = new HashSet< String>();558 HashSet<String> ret = new HashSet<>(); 559 559 for (Tag tag: tags) { 560 560 ret.add(tag.getValue()); … … 572 572 */ 573 573 public Set<String> getValues(String key) { 574 HashSet<String> ret = new HashSet< String>();574 HashSet<String> ret = new HashSet<>(); 575 575 if (key == null) return ret; 576 576 for (Tag tag: tags) { … … 733 733 } 734 734 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<>(); 737 737 for (String v : originalValues) { 738 738 List<String> vs = Arrays.asList(SPLIT_VALUES_PATTERN.split(v)); -
trunk/src/org/openstreetmap/josm/data/osm/TigerUtils.java
r6990 r7005 46 46 47 47 public static String combineTags(String name, Set<String> values) { 48 TreeSet<Object> resultSet = new TreeSet< Object>();48 TreeSet<Object> resultSet = new TreeSet<>(); 49 49 for (String value: values) { 50 50 String[] parts = value.split(":"); … … 68 68 69 69 public static String combineTags(String name, String t1, String t2) { 70 Set<String> set = new TreeSet< String>();70 Set<String> set = new TreeSet<>(); 71 71 set.add(t1); 72 72 set.add(t2); -
trunk/src/org/openstreetmap/josm/data/osm/User.java
r6889 r7005 30 30 * the map of known users 31 31 */ 32 private static Map<Long,User> userMap = new HashMap< Long,User>();32 private static Map<Long,User> userMap = new HashMap<>(); 33 33 private static final User anonymous = createLocalUser(tr("<anonymous>")); 34 34 … … 102 102 name = ""; 103 103 } 104 List<User> ret = new ArrayList< User>();104 List<User> ret = new ArrayList<>(); 105 105 for (User user: userMap.values()) { 106 106 if (user.hasName(name)) { … … 120 120 121 121 /** the user name */ 122 private final Set<String> names = new HashSet< String>();122 private final Set<String> names = new HashSet<>(); 123 123 /** the user id */ 124 124 private final long uid; … … 139 139 */ 140 140 public List<String> getNames() { 141 return new ArrayList< String>(names);141 return new ArrayList<>(names); 142 142 } 143 143 -
trunk/src/org/openstreetmap/josm/data/osm/Way.java
r6830 r7005 42 42 */ 43 43 public List<Node> getNodes() { 44 return new CopyList< Node>(nodes);44 return new CopyList<>(nodes); 45 45 } 46 46 … … 167 167 */ 168 168 public Set<Node> getNeighbours(Node node) { 169 HashSet<Node> neigh = new HashSet< Node>();169 HashSet<Node> neigh = new HashSet<>(); 170 170 171 171 if (node == null) return neigh; … … 191 191 */ 192 192 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<>(); 194 194 if (isIncomplete()) return chunkSet; 195 195 Node lastN = null; … … 200 200 continue; 201 201 } 202 Pair<Node,Node> np = new Pair< Node,Node>(lastN, n);202 Pair<Node,Node> np = new Pair<>(lastN, n); 203 203 if (sort) { 204 204 Pair.sort(np); … … 284 284 WayData wayData = (WayData) data; 285 285 286 List<Node> newNodes = new ArrayList< Node>(wayData.getNodes().size());286 List<Node> newNodes = new ArrayList<>(wayData.getNodes().size()); 287 287 for (Long nodeId : wayData.getNodes()) { 288 288 Node node = (Node)getDataSet().getPrimitiveById(nodeId, OsmPrimitiveType.NODE); … … 386 386 try { 387 387 boolean closed = (lastNode() == firstNode() && selection.contains(lastNode())); 388 List<Node> copy = new ArrayList< Node>();388 List<Node> copy = new ArrayList<>(); 389 389 390 390 for (Node n: nodes) { -
trunk/src/org/openstreetmap/josm/data/osm/WayData.java
r6009 r7005 9 9 public class WayData extends PrimitiveData implements IWay { 10 10 11 private List<Long> nodes = new ArrayList< Long>();11 private List<Long> nodes = new ArrayList<>(); 12 12 13 13 public WayData() { … … 41 41 42 42 public void setNodes(List<Long> nodes) { 43 this.nodes = new ArrayList< Long>(nodes);43 this.nodes = new ArrayList<>(nodes); 44 44 } 45 45 -
trunk/src/org/openstreetmap/josm/data/osm/event/DatasetEventManager.java
r6084 r7005 68 68 } 69 69 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<>(); 73 73 private final DataSetListener myListener = new DataSetListenerAdapter(this); 74 74 75 /** 76 * Constructs a new {@code DatasetEventManager}. 77 */ 75 78 public DatasetEventManager() { 76 79 MapView.addEditLayerChangeListener(this); … … 139 142 public void run() { 140 143 while (!eventsInEDT.isEmpty()) { 141 List<AbstractDatasetChangedEvent> events = new ArrayList< AbstractDatasetChangedEvent>();144 List<AbstractDatasetChangedEvent> events = new ArrayList<>(); 142 145 events.addAll(eventsInEDT); 143 146 … … 187 190 } 188 191 } else { 189 consolidatedEvent = new DataChangedEvent(dataSet, 190 new ArrayList<AbstractDatasetChangedEvent>(Arrays.asList(consolidatedEvent))); 192 consolidatedEvent = new DataChangedEvent(dataSet, new ArrayList<>(Arrays.asList(consolidatedEvent))); 191 193 } 192 194 -
trunk/src/org/openstreetmap/josm/data/osm/event/PrimitivesAddedEvent.java
r5170 r7005 17 17 public PrimitivesAddedEvent(DataSet dataSet, Collection<? extends OsmPrimitive> primitives, boolean wasIncomplete) { 18 18 super(dataSet); 19 this.primitives = Collections.unmodifiableList(new ArrayList< OsmPrimitive>(primitives));19 this.primitives = Collections.unmodifiableList(new ArrayList<>(primitives)); 20 20 this.wasIncomplete = wasIncomplete; 21 21 } -
trunk/src/org/openstreetmap/josm/data/osm/event/PrimitivesRemovedEvent.java
r5170 r7005 17 17 public PrimitivesRemovedEvent(DataSet dataSet, Collection<? extends OsmPrimitive> primitives, boolean wasComplete) { 18 18 super(dataSet); 19 this.primitives = Collections.unmodifiableList(new ArrayList< OsmPrimitive>(primitives));19 this.primitives = Collections.unmodifiableList(new ArrayList<>(primitives)); 20 20 this.wasComplete = wasComplete; 21 21 } -
trunk/src/org/openstreetmap/josm/data/osm/event/SelectionEventManager.java
r6361 r7005 45 45 46 46 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<>(); 49 49 50 50 /** -
trunk/src/org/openstreetmap/josm/data/osm/history/History.java
r6830 r7005 25 25 26 26 private static History filter(History history, FilterPredicate predicate) { 27 List<HistoryOsmPrimitive> out = new ArrayList< HistoryOsmPrimitive>();27 List<HistoryOsmPrimitive> out = new ArrayList<>(); 28 28 for (HistoryOsmPrimitive primitive: history.versions) { 29 29 if (predicate.matches(primitive)) { … … 56 56 this.id = id; 57 57 this.type = type; 58 this.versions = new ArrayList< HistoryOsmPrimitive>();58 this.versions = new ArrayList<>(); 59 59 if (versions != null) { 60 60 this.versions.addAll(versions); … … 63 63 64 64 public History sortAscending() { 65 List<HistoryOsmPrimitive> copy = new ArrayList< HistoryOsmPrimitive>(versions);65 List<HistoryOsmPrimitive> copy = new ArrayList<>(versions); 66 66 Collections.sort( 67 67 copy, … … 77 77 78 78 public History sortDescending() { 79 List<HistoryOsmPrimitive> copy = new ArrayList< HistoryOsmPrimitive>(versions);79 List<HistoryOsmPrimitive> copy = new ArrayList<>(versions); 80 80 Collections.sort( 81 81 copy, -
trunk/src/org/openstreetmap/josm/data/osm/history/HistoryDataSet.java
r6830 r7005 52 52 */ 53 53 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<>(); 57 57 } 58 58 … … 187 187 188 188 public Collection<Long> getChangesetIds() { 189 final HashSet<Long> ids = new HashSet< Long>();189 final HashSet<Long> ids = new HashSet<>(); 190 190 for (Collection<HistoryOsmPrimitive> i : data.values()) { 191 191 for (HistoryOsmPrimitive j : i) { -
trunk/src/org/openstreetmap/josm/data/osm/history/HistoryOsmPrimitive.java
r6890 r7005 89 89 this.changesetId = changesetId; 90 90 this.timestamp = timestamp; 91 tags = new HashMap< String, String>();91 tags = new HashMap<>(); 92 92 } 93 93 … … 191 191 public void setTags(Map<String,String> tags) { 192 192 if (tags == null) { 193 this.tags = new HashMap< String, String>();193 this.tags = new HashMap<>(); 194 194 } else { 195 this.tags = new HashMap< String, String>(tags);195 this.tags = new HashMap<>(tags); 196 196 } 197 197 } -
trunk/src/org/openstreetmap/josm/data/osm/history/HistoryRelation.java
r6830 r7005 21 21 public class HistoryRelation extends HistoryOsmPrimitive{ 22 22 23 private List<RelationMemberData> members = new ArrayList< RelationMemberData>();23 private List<RelationMemberData> members = new ArrayList<>(); 24 24 25 25 /** -
trunk/src/org/openstreetmap/josm/data/osm/history/HistoryWay.java
r6830 r7005 21 21 public class HistoryWay extends HistoryOsmPrimitive { 22 22 23 private List<Long> nodeIds = new ArrayList< Long>();23 private List<Long> nodeIds = new ArrayList<>(); 24 24 25 25 /** -
trunk/src/org/openstreetmap/josm/data/osm/visitor/AllNodesVisitor.java
r6380 r7005 21 21 * The resulting nodes collected so far. 22 22 */ 23 public Collection<Node> nodes = new HashSet< Node>();23 public Collection<Node> nodes = new HashSet<>(); 24 24 25 25 /** -
trunk/src/org/openstreetmap/josm/data/osm/visitor/MergeSourceBuildingVisitor.java
r6317 r7005 49 49 this.selectionBase = selectionBase; 50 50 this.hull = new DataSet(); 51 this.mappedPrimitives = new HashMap< OsmPrimitive, PrimitiveData>();51 this.mappedPrimitives = new HashMap<>(); 52 52 } 53 53 … … 80 80 return; 81 81 WayData clone = w.save(); 82 List<Long> newNodes = new ArrayList< Long>(w.getNodesCount());82 List<Long> newNodes = new ArrayList<>(w.getNodesCount()); 83 83 for (Node n: w.getNodes()) { 84 84 newNodes.add(mappedPrimitives.get(n).getUniqueId()); … … 102 102 } 103 103 104 List<RelationMemberData> newMembers = new ArrayList< RelationMemberData>();104 List<RelationMemberData> newMembers = new ArrayList<>(); 105 105 for (RelationMember member: r.getMembers()) { 106 106 newMembers.add( -
trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/MapRendererFactory.java
r7004 r7005 110 110 } 111 111 112 private final List<Descriptor> descriptors = new ArrayList< Descriptor>();112 private final List<Descriptor> descriptors = new ArrayList<>(); 113 113 private Class<? extends AbstractMapRenderer> activeRenderer = null; 114 114 -
trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java
r6926 r7005 183 183 this.drawMultipolygon = drawMultipolygon; 184 184 this.drawRestriction = drawRestriction; 185 styleElems = new ArrayList< StyleRecord>();185 styleElems = new ArrayList<>(); 186 186 } 187 187 -
trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/WireframeMapRenderer.java
r6380 r7005 168 168 169 169 // 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<>(); 172 172 173 173 for (final Way way : data.searchWays(bbox)){ -
trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/relations/Multipolygon.java
r6890 r7005 56 56 */ 57 57 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<>(); 62 62 63 63 private void initDefaults() { … … 202 202 private PolyData(List<Node> nodes, boolean selected, Collection<Long> wayIds) { 203 203 this.wayIds = Collections.unmodifiableCollection(wayIds); 204 this.nodes = new ArrayList< Node>(nodes);204 this.nodes = new ArrayList<>(nodes); 205 205 this.selected = selected; 206 this.inners = new ArrayList< Multipolygon.PolyData>();206 this.inners = new ArrayList<>(); 207 207 this.poly = new Path2D.Double(); 208 208 this.poly.setWindingRule(Path2D.WIND_EVEN_ODD); … … 235 235 this.poly = (Double) copy.poly.clone(); 236 236 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); 239 239 } 240 240 … … 297 297 nodes.addAll(w.getNodes()); 298 298 } else if (!wayIds.isEmpty()) { 299 List<Way> waysToJoin = new ArrayList< Way>();299 List<Way> waysToJoin = new ArrayList<>(); 300 300 for (Long wayId : wayIds) { 301 301 Way w = (Way) ds.getPrimitiveById(wayId, OsmPrimitiveType.WAY); … … 347 347 } 348 348 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<>(); 354 354 355 355 private boolean incomplete; … … 397 397 398 398 private void createPolygons(List<Way> ways, List<PolyData> result) { 399 List<Way> waysToJoin = new ArrayList< Way>();399 List<Way> waysToJoin = new ArrayList<>(); 400 400 for (Way way: ways) { 401 401 if (way.isClosed()) { … … 413 413 public static Collection<JoinedWay> joinWays(Collection<Way> waysToJoin) 414 414 { 415 final Collection<JoinedWay> result = new ArrayList< JoinedWay>();415 final Collection<JoinedWay> result = new ArrayList<>(); 416 416 final Way[] joinArray = waysToJoin.toArray(new Way[waysToJoin.size()]); 417 417 int left = waysToJoin.size(); … … 420 420 boolean selected = false; 421 421 List<Node> nodes = null; 422 Set<Long> wayIds = new HashSet< Long>();422 Set<Long> wayIds = new HashSet<>(); 423 423 boolean joined = true; 424 424 while (joined && left > 0) { -
trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/relations/MultipolygonCache.java
r6986 r7005 47 47 48 48 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<>(); 51 51 Main.addProjectionChangeListener(this); 52 52 DataSet.addSelectionListener(this); … … 71 71 Map<DataSet, Map<Relation, Multipolygon>> map1 = cache.get(nc); 72 72 if (map1 == null) { 73 cache.put(nc, map1 = new HashMap< DataSet, Map<Relation, Multipolygon>>());73 cache.put(nc, map1 = new HashMap<>()); 74 74 } 75 75 Map<Relation, Multipolygon> map2 = map1.get(r.getDataSet()); 76 76 if (map2 == null) { 77 map1.put(r.getDataSet(), map2 = new HashMap< Relation, Multipolygon>());77 map1.put(r.getDataSet(), map2 = new HashMap<>()); 78 78 } 79 79 multipolygon = map2.get(r); … … 113 113 114 114 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<>(); 116 116 for (Map<DataSet, Map<Relation, Multipolygon>> map : cache.values()) { 117 117 Map<Relation, Multipolygon> map2 = map.get(ds); -
trunk/src/org/openstreetmap/josm/data/projection/CustomProjection.java
r6990 r7005 75 75 public boolean hasValue; 76 76 77 public static final Map<String, Param> paramsByKey = new HashMap< String, Param>();77 public static final Map<String, Param> paramsByKey = new HashMap<>(); 78 78 static { 79 79 for (Param p : Param.values()) { … … 161 161 162 162 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<>(); 164 164 String[] parts = Utils.WHITE_SPACES_PATTERN.split(pref.trim()); 165 165 if (pref.trim().isEmpty()) { … … 292 292 if (numStr.length != 3 && numStr.length != 7) 293 293 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<>(); 295 295 for (String str : numStr) { 296 296 try { -
trunk/src/org/openstreetmap/josm/data/projection/Projections.java
r6995 r7005 60 60 * should be compatible to PROJ.4 61 61 */ 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<>(); 67 67 68 68 static { … … 158 158 } 159 159 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<>(); 163 163 164 164 static { -
trunk/src/org/openstreetmap/josm/data/projection/datum/NTV2GridShiftFile.java
r6995 r7005 167 167 private NTV2SubGrid[] createSubGridTree(NTV2SubGrid[] subGrid) { 168 168 int topLevelCount = 0; 169 HashMap<String, List<NTV2SubGrid>> subGridMap = new HashMap< String, List<NTV2SubGrid>>();169 HashMap<String, List<NTV2SubGrid>> subGridMap = new HashMap<>(); 170 170 for (int i = 0; i < subGrid.length; i++) { 171 171 if ("NONE".equalsIgnoreCase(subGrid[i].getParentSubGridName())) { -
trunk/src/org/openstreetmap/josm/data/validation/OsmValidator.java
r6995 r7005 77 77 public static double griddetail; 78 78 79 public static final Collection<String> ignoredErrors = new TreeSet< String>();79 public static final Collection<String> ignoredErrors = new TreeSet<>(); 80 80 81 81 /** … … 124 124 private static Map<String, Test> allTestsMap; 125 125 static { 126 allTestsMap = new HashMap< String, Test>();126 allTestsMap = new HashMap<>(); 127 127 for (Class<Test> testClass : allAvailableTests) { 128 128 try { … … 226 226 applyPrefs(allTestsMap, false); 227 227 applyPrefs(allTestsMap, true); 228 return new TreeMap< String, Test>(allTestsMap);228 return new TreeMap<>(allTestsMap); 229 229 } 230 230 … … 263 263 public static Collection<Test> getEnabledTests(boolean beforeUpload) { 264 264 Collection<Test> enabledTests = getTests(); 265 for (Test t : new ArrayList< Test>(enabledTests)) {265 for (Test t : new ArrayList<>(enabledTests)) { 266 266 if (beforeUpload ? t.testBeforeUpload : t.enabled) { 267 267 continue; -
trunk/src/org/openstreetmap/josm/data/validation/PaintVisitor.java
r6009 r7005 34 34 private boolean selected; 35 35 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<>(); 38 38 39 39 /** -
trunk/src/org/openstreetmap/josm/data/validation/Test.java
r6990 r7005 58 58 59 59 /** The list of errors */ 60 protected List<TestError> errors = new ArrayList< TestError>(30);60 protected List<TestError> errors = new ArrayList<>(30); 61 61 62 62 /** Whether the test is run on a partial selection data */ … … 152 152 this.progressMonitor.beginTask(startMessage); 153 153 Main.debug(startMessage); 154 this.errors = new ArrayList< TestError>(30);154 this.errors = new ArrayList<>(30); 155 155 this.startTime = System.currentTimeMillis(); 156 156 } … … 307 307 */ 308 308 protected final Command deletePrimitivesIfNeeded(Collection<? extends OsmPrimitive> primitives) { 309 Collection<OsmPrimitive> primitivesToDelete = new ArrayList< OsmPrimitive>();309 Collection<OsmPrimitive> primitivesToDelete = new ArrayList<>(); 310 310 for (OsmPrimitive p : primitives) { 311 311 if (!p.isDeleted()) { -
trunk/src/org/openstreetmap/josm/data/validation/TestError.java
r6804 r7005 133 133 */ 134 134 public Collection<? extends OsmPrimitive> getSelectablePrimitives() { 135 List<OsmPrimitive> selectablePrimitives = new ArrayList< OsmPrimitive>(primitives.size());135 List<OsmPrimitive> selectablePrimitives = new ArrayList<>(primitives.size()); 136 136 for (OsmPrimitive o : primitives) { 137 137 if (o.isSelectable()) { … … 170 170 */ 171 171 public String getIgnoreState() { 172 Collection<String> strings = new TreeSet< String>();172 Collection<String> strings = new TreeSet<>(); 173 173 StringBuilder ignorestring = new StringBuilder(getIgnoreSubGroup()); 174 174 for (OsmPrimitive o : primitives) { -
trunk/src/org/openstreetmap/josm/data/validation/tests/Addresses.java
r6826 r7005 117 117 if (r.hasTag("type", ASSOCIATED_STREET)) { 118 118 // 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<>(); 120 120 // Used to detect different street names 121 121 String relationName = r.get("name"); 122 Set<OsmPrimitive> wrongStreetNames = new HashSet< OsmPrimitive>();122 Set<OsmPrimitive> wrongStreetNames = new HashSet<>(); 123 123 // 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<>(); 126 126 for (RelationMember m : r.getMembers()) { 127 127 String role = m.getRole(); … … 134 134 List<OsmPrimitive> list = map.get(number); 135 135 if (list == null) { 136 map.put(number, list = new ArrayList< OsmPrimitive>());136 map.put(number, list = new ArrayList<>()); 137 137 } 138 138 list.add(p); -
trunk/src/org/openstreetmap/josm/data/validation/tests/Coastlines.java
r6475 r7005 59 59 } 60 60 61 coastlines = new LinkedList< Way>();61 coastlines = new LinkedList<>(); 62 62 } 63 63 … … 145 145 } 146 146 147 List<OsmPrimitive> primitives = new ArrayList< OsmPrimitive>();147 List<OsmPrimitive> primitives = new ArrayList<>(); 148 148 primitives.add(c1); 149 149 150 150 if (headWays == 0 || tailWays == 0) { 151 List<OsmPrimitive> highlight = new ArrayList< OsmPrimitive>();151 List<OsmPrimitive> highlight = new ArrayList<>(); 152 152 153 153 if (headWays == 0 && head.getCoor().isIn(downloadedArea)) { … … 178 178 179 179 if (unordered) { 180 List<OsmPrimitive> highlight = new ArrayList< OsmPrimitive>();180 List<OsmPrimitive> highlight = new ArrayList<>(); 181 181 182 182 if (headWays > 1 || headUnordered || headReversed || reversed) { -
trunk/src/org/openstreetmap/josm/data/validation/tests/ConditionalKeys.java
r6625 r7005 23 23 24 24 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", 26 26 "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", 28 28 "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", 30 30 "horse", "vehicle", "bicycle", "carriage", "trailer", "caravan", "motor_vehicle", "motorcycle", "moped", "mofa", 31 31 "motorcar", "motorhome", "psv", "bus", "taxi", "tourist_bus", "goods", "hgv", "agricultural", "atv", "snowmobile" 32 32 /*,"hov","emergency","hazmat","disabled"*/)); 33 33 34 /** 35 * Constructs a new {@code ConditionalKeys}. 36 */ 34 37 public ConditionalKeys() { 35 38 super(tr("Conditional Keys"), tr("Tests for the correct usage of ''*:conditional'' tags.")); … … 94 97 public static List<ConditionalValue> parse(String value) throws ConditionalParsingException { 95 98 // <restriction-value> @ <condition>[;<restriction-value> @ <condition>] 96 final List<ConditionalValue> r = new ArrayList< ConditionalValue>();99 final List<ConditionalValue> r = new ArrayList<>(); 97 100 final Pattern part = Pattern.compile("([^@\\p{Space}][^@]*?)" + "\\s*@\\s*" + "(\\([^)\\p{Space}][^)]+?\\)|[^();\\p{Space}][^();]*?)\\s*"); 98 101 final Matcher m = Pattern.compile("(" + part + ")(;\\s*" + part + ")*").matcher(value); … … 137 140 138 141 public List<TestError> validatePrimitive(OsmPrimitive p) { 139 final List<TestError> errors = new ArrayList< TestError>();142 final List<TestError> errors = new ArrayList<>(); 140 143 for (final String key : Utils.filter(p.keySet(), Predicates.stringMatchesPattern(Pattern.compile(".*:conditional$")))) { 141 144 if (!isKeyValid(key)) { -
trunk/src/org/openstreetmap/josm/data/validation/tests/CrossingWays.java
r6869 r7005 185 185 public void startTest(ProgressMonitor monitor) { 186 186 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); 190 190 } 191 191 … … 247 247 prims = Arrays.asList(es1.way, es2.way); 248 248 if ((highlight = seenWays.get(prims)) == null) { 249 highlight = new ArrayList< WaySegment>();249 highlight = new ArrayList<>(); 250 250 highlight.add(es1); 251 251 highlight.add(es2); … … 278 278 public List<List<WaySegment>> getSegments(EastNorth n1, EastNorth n2) { 279 279 280 List<List<WaySegment>> cells = new ArrayList< List<WaySegment>>();280 List<List<WaySegment>> cells = new ArrayList<>(); 281 281 for (Point2D cell : ValUtil.getSegmentCells(n1, n2, OsmValidator.griddetail)) { 282 282 List<WaySegment> segments = cellSegments.get(cell); 283 283 if (segments == null) { 284 segments = new ArrayList< WaySegment>();284 segments = new ArrayList<>(); 285 285 cellSegments.put(cell, segments); 286 286 } -
trunk/src/org/openstreetmap/josm/data/validation/tests/DuplicateNode.java
r6883 r7005 118 118 public void startTest(ProgressMonitor monitor) { 119 119 super.startTest(monitor); 120 potentialDuplicates = new Storage< Object>(new NodeHash());120 potentialDuplicates = new Storage<>(new NodeHash()); 121 121 } 122 122 … … 133 133 // multiple nodes at the same position -> check if all nodes have a distinct elevation 134 134 List<Node> nodes = (List<Node>) v; 135 Set<String> eles = new HashSet< String>();135 Set<String> eles = new HashSet<>(); 136 136 for (Node n : nodes) { 137 137 String ele = n.get("ele"); … … 161 161 */ 162 162 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<>(); 166 166 for (Node n: nodes) { 167 167 mm.put(n.getKeys(), n); 168 168 } 169 169 170 Map<String,Boolean> typeMap=new HashMap< String,Boolean>();170 Map<String,Boolean> typeMap=new HashMap<>(); 171 171 String[] types = {"none", "highway", "railway", "waterway", "boundary", "power", "natural", "landuse", "building"}; 172 172 … … 334 334 // 335 335 if (!mm.isEmpty()) { 336 List<OsmPrimitive> duplicates = new ArrayList< OsmPrimitive>();336 List<OsmPrimitive> duplicates = new ArrayList<>(); 337 337 for (Set<OsmPrimitive> l: mm.values()) { 338 338 duplicates.addAll(l); … … 365 365 // 366 366 Node n1 = (Node)potentialDuplicates.get(n); 367 List<Node> nodes = new ArrayList< Node>(2);367 List<Node> nodes = new ArrayList<>(2); 368 368 nodes.add(n1); 369 369 nodes.add(n); … … 385 385 public Command fixError(TestError testError) { 386 386 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)); 389 389 390 390 // Filter nodes that have already been deleted (see #5764 and #5773) -
trunk/src/org/openstreetmap/josm/data/validation/tests/DuplicateRelation.java
r6494 r7005 72 72 type = src.getType(); 73 73 relId = 0; 74 coor = new ArrayList< LatLon>();74 coor = new ArrayList<>(); 75 75 76 76 if (src.isNode()) { 77 77 Node r = src.getNode(); 78 78 tags = r.getKeys(); 79 coor = new ArrayList< LatLon>(1);79 coor = new ArrayList<>(1); 80 80 coor.add(r.getCoor()); 81 81 } … … 84 84 tags = r.getKeys(); 85 85 List<Node> wNodes = r.getNodes(); 86 coor = new ArrayList< LatLon>(wNodes.size());86 coor = new ArrayList<>(wNodes.size()); 87 87 for (Node wNode : wNodes) { 88 88 coor.add(wNode.getCoor()); … … 93 93 tags = r.getKeys(); 94 94 relId = r.getId(); 95 coor = new ArrayList< LatLon>();95 coor = new ArrayList<>(); 96 96 } 97 97 } … … 109 109 */ 110 110 public RelationMembers(List<RelationMember> members) { 111 this.members = new ArrayList< RelMember>(members.size());111 this.members = new ArrayList<>(members.size()); 112 112 for (RelationMember member : members) { 113 113 this.members.add(new RelMember(member)); … … 172 172 173 173 /** 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()); 175 175 176 176 /** … … 185 185 public void startTest(ProgressMonitor monitor) { 186 186 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); 189 189 } 190 190 … … 229 229 if (testError.getCode() == SAME_RELATION) return null; 230 230 Collection<? extends OsmPrimitive> sel = testError.getPrimitives(); 231 HashSet<Relation> relFix = new HashSet< Relation>();231 HashSet<Relation> relFix = new HashSet<>(); 232 232 233 233 for (OsmPrimitive osm : sel) … … 263 263 } 264 264 265 Collection<Command> commands = new LinkedList< Command>();265 Collection<Command> commands = new LinkedList<>(); 266 266 267 267 // Fix relations. … … 292 292 // We fix it only if there is no more than one relation that is relation member. 293 293 Collection<? extends OsmPrimitive> sel = testError.getPrimitives(); 294 HashSet<Relation> relations = new HashSet< Relation>();294 HashSet<Relation> relations = new HashSet<>(); 295 295 296 296 for (OsmPrimitive osm : sel) -
trunk/src/org/openstreetmap/josm/data/validation/tests/DuplicateWay.java
r6494 r7005 107 107 public void startTest(ProgressMonitor monitor) { 108 108 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); 112 112 } 113 113 … … 168 168 return; 169 169 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 test170 List<Node> wNodesToUse = new ArrayList<>(wNodes.size()); // The list that will be considered for this test 171 171 if (w.isClosed()) { 172 172 // In case of a closed way, build the list of lat/lon starting from the node with the lowest id … … 192 192 } 193 193 // Build the list of lat/lon 194 List<LatLon> wLat = new ArrayList< LatLon>(wNodesToUse.size());194 List<LatLon> wLat = new ArrayList<>(wNodesToUse.size()); 195 195 for (Node node : wNodesToUse) { 196 196 wLat.add(node.getCoor()); … … 200 200 int hash = wLat.hashCode(); 201 201 if (!knownHashCodes.contains(hash)) { 202 List<LatLon> reversedwLat = new ArrayList< LatLon>(wLat);202 List<LatLon> reversedwLat = new ArrayList<>(wLat); 203 203 Collections.reverse(reversedwLat); 204 204 int reverseHash = reversedwLat.hashCode(); … … 226 226 public Command fixError(TestError testError) { 227 227 Collection<? extends OsmPrimitive> sel = testError.getPrimitives(); 228 HashSet<Way> ways = new HashSet< Way>();228 HashSet<Way> ways = new HashSet<>(); 229 229 230 230 for (OsmPrimitive osm : sel) { … … 261 261 } 262 262 263 Collection<Command> commands = new LinkedList< Command>();263 Collection<Command> commands = new LinkedList<>(); 264 264 265 265 // Fix relations. … … 294 294 // We fix it only if there is no more than one way that is relation member. 295 295 Collection<? extends OsmPrimitive> sel = testError.getPrimitives(); 296 HashSet<Way> ways = new HashSet< Way>();296 HashSet<Way> ways = new HashSet<>(); 297 297 298 298 for (OsmPrimitive osm : sel) { -
trunk/src/org/openstreetmap/josm/data/validation/tests/Highways.java
r6937 r7005 111 111 112 112 private void testWrongRoundabout(Way w) { 113 Map<String, List<Way>> map = new HashMap< String, List<Way>>();113 Map<String, List<Way>> map = new HashMap<>(); 114 114 // Count all highways (per type) connected to this roundabout, except links 115 115 // 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())) { 117 117 for (Way h : Utils.filteredCollection(n.getReferrers(), Way.class)) { 118 118 String value = h.get("highway"); … … 120 120 List<Way> list = map.get(value); 121 121 if (list == null) { 122 map.put(value, list = new ArrayList< Way>());122 map.put(value, list = new ArrayList<>()); 123 123 } 124 124 list.add(h); … … 150 150 } 151 151 152 final HashSet<OsmPrimitive> referrers = new HashSet< OsmPrimitive>();152 final HashSet<OsmPrimitive> referrers = new HashSet<>(); 153 153 referrers.addAll(way.firstNode().getReferrers()); 154 154 referrers.addAll(way.lastNode().getReferrers()); -
trunk/src/org/openstreetmap/josm/data/validation/tests/Lanes.java
r6834 r7005 41 41 return; 42 42 } 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>() { 44 44 @Override 45 45 public Integer apply(String key) { -
trunk/src/org/openstreetmap/josm/data/validation/tests/MapCSSTagChecker.java
r6986 r7005 69 69 } 70 70 71 final List<TagCheck> checks = new ArrayList< TagCheck>();71 final List<TagCheck> checks = new ArrayList<>(); 72 72 73 73 static class TagCheck implements Predicate<OsmPrimitive> { 74 74 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<>(); 80 80 81 81 TagCheck(MapCSSRule rule) { … … 180 180 // Ignore "meta" rule(s) from external rules of JOSM wiki 181 181 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>() { 183 183 @Override 184 184 public TagCheck apply(MapCSSRule x) { … … 297 297 } 298 298 final Selector matchingSelector = whichSelectorMatchesPrimitive(p); 299 Collection<Command> cmds = new LinkedList< Command>();299 Collection<Command> cmds = new LinkedList<>(); 300 300 for (PrimitiveToTag toTag : change) { 301 301 final Tag tag = toTag.apply(p); … … 416 416 */ 417 417 public Collection<TestError> getErrorsForPrimitive(OsmPrimitive p, boolean includeOtherSeverity) { 418 final ArrayList<TestError> r = new ArrayList< TestError>();418 final ArrayList<TestError> r = new ArrayList<>(); 419 419 final Environment env = new Environment(p, new MultiCascade(), Environment.DEFAULT_LAYER, null); 420 420 for (TagCheck check : checks) { -
trunk/src/org/openstreetmap/josm/data/validation/tests/MultipolygonTest.java
r6731 r7005 57 57 private static ElemStyles styles; 58 58 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<>(); 61 61 62 62 /** … … 92 92 93 93 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<>(); 96 96 for (Way way : ways) { 97 97 if (way.isClosed()) { … … 123 123 124 124 private List<GeneralPath> createPolygons(List<List<Node>> joinedWays) { 125 List<GeneralPath> result = new ArrayList< GeneralPath>();125 List<GeneralPath> result = new ArrayList<>(); 126 126 for (List<Node> way : joinedWays) { 127 127 result.add(createPath(way)); … … 229 229 230 230 if (areaInner != null && area.equals(areaInner)) { 231 List<OsmPrimitive> l = new ArrayList< OsmPrimitive>();231 List<OsmPrimitive> l = new ArrayList<>(); 232 232 l.add(r); 233 233 l.add(wInner); … … 240 240 AreaElemStyle areaOuter = ElemStyles.getAreaElemStyle(wOuter, false); 241 241 if (areaOuter != null && !area.equals(areaOuter)) { 242 List<OsmPrimitive> l = new ArrayList< OsmPrimitive>();242 List<OsmPrimitive> l = new ArrayList<>(); 243 243 l.add(r); 244 244 l.add(wOuter); … … 251 251 } 252 252 253 List<Node> openNodes = new LinkedList< Node>();253 List<Node> openNodes = new LinkedList<>(); 254 254 for (List<Node> w : nonClosedWays) { 255 255 if (w.size()<1) continue; … … 258 258 } 259 259 if (!openNodes.isEmpty()) { 260 List<OsmPrimitive> primitives = new LinkedList< OsmPrimitive>();260 List<OsmPrimitive> primitives = new LinkedList<>(); 261 261 primitives.add(r); 262 262 primitives.addAll(openNodes); … … 282 282 } 283 283 if (outside || crossing) { 284 List<List<Node>> highlights = new ArrayList< List<Node>>();284 List<List<Node>> highlights = new ArrayList<>(); 285 285 highlights.add(pdInner); 286 286 if (outside) { … … 319 319 } 320 320 } 321 List<OsmPrimitive> newPrimitives = new ArrayList< OsmPrimitive>(primitives);321 List<OsmPrimitive> newPrimitives = new ArrayList<>(primitives); 322 322 newPrimitives.add(0, r); 323 323 error.setPrimitives(newPrimitives); -
trunk/src/org/openstreetmap/josm/data/validation/tests/NameMismatch.java
r6823 r7005 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 5 6 import java.util.Collection;7 6 import java.util.HashSet; 8 7 import java.util.Map.Entry; … … 61 60 @Override 62 61 public void check(OsmPrimitive p) { 63 HashSet<String> names = new HashSet< String>();62 HashSet<String> names = new HashSet<>(); 64 63 65 64 for (Entry<String, String> entry : p.getKeys().entrySet()) { -
trunk/src/org/openstreetmap/josm/data/validation/tests/OpeningHourTest.java
r7004 r7005 191 191 return Collections.emptyList(); 192 192 } 193 final List<OpeningHoursTestError> errors = new ArrayList< OpeningHoursTestError>();193 final List<OpeningHoursTestError> errors = new ArrayList<>(); 194 194 try { 195 195 final Object r = parse(value, mode); -
trunk/src/org/openstreetmap/josm/data/validation/tests/OverlappingWays.java
r6940 r7005 64 64 public void startTest(ProgressMonitor monitor) { 65 65 super.startTest(monitor); 66 nodePairs = new MultiMap< Pair<Node,Node>, WaySegment>(1000);66 nodePairs = new MultiMap<>(1000); 67 67 } 68 68 … … 78 78 @Override 79 79 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<>(); 83 83 for (Set<WaySegment> duplicated : nodePairs.values()) { 84 84 int ways = duplicated.size(); 85 85 86 86 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<>(); 89 89 Collection<WaySegment> highlight; 90 90 int highway = 0; … … 178 178 protected static Set<WaySegment> checkDuplicateWaySegment(Way w) { 179 179 // test for ticket #4959 180 Set<WaySegment> segments = new TreeSet< WaySegment>(new Comparator<WaySegment>() {180 Set<WaySegment> segments = new TreeSet<>(new Comparator<WaySegment>() { 181 181 @Override 182 182 public int compare(WaySegment o1, WaySegment o2) { … … 190 190 } 191 191 }); 192 final Set<WaySegment> duplicateWaySegments = new HashSet< WaySegment>();192 final Set<WaySegment> duplicateWaySegments = new HashSet<>(); 193 193 194 194 for (int i = 0; i < w.getNodesCount() - 1; i++) { … … 224 224 continue; 225 225 } 226 nodePairs.put(Pair.sort(new Pair< Node,Node>(lastN, n)),226 nodePairs.put(Pair.sort(new Pair<>(lastN, n)), 227 227 new WaySegment(w, i)); 228 228 lastN = n; -
trunk/src/org/openstreetmap/josm/data/validation/tests/PowerLines.java
r6903 r7005 45 45 public static final Collection<String> POWER_ALLOWED_TAGS = Arrays.asList("switch", "transformer", "busbar", "generator"); 46 46 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<>(); 52 52 53 53 /** … … 118 118 protected final boolean isInPowerStation(Node n) { 119 119 for (OsmPrimitive station : powerStations) { 120 List<List<Node>> nodesLists = new ArrayList< List<Node>>();120 List<List<Node>> nodesLists = new ArrayList<>(); 121 121 if (station instanceof Way) { 122 122 nodesLists.add(((Way)station).getNodes()); -
trunk/src/org/openstreetmap/josm/data/validation/tests/RelationChecker.java
r6863 r7005 65 65 } 66 66 67 private static Collection<TaggingPreset> relationpresets = new LinkedList< TaggingPreset>();67 private static Collection<TaggingPreset> relationpresets = new LinkedList<>(); 68 68 69 69 /** … … 87 87 private static class RoleInfo { 88 88 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<>(); 93 93 } 94 94 … … 96 96 @Override 97 97 public void visit(Relation n) { 98 LinkedList<Role> allroles = new LinkedList< Role>();98 LinkedList<Role> allroles = new LinkedList<>(); 99 99 for (TaggingPreset p : relationpresets) { 100 100 boolean matches = true; … … 124 124 RELATION_UNKNOWN, n) ); 125 125 } else { 126 HashMap<String,RoleInfo> map = new HashMap< String, RoleInfo>();126 HashMap<String,RoleInfo> map = new HashMap<>(); 127 127 for (RelationMember m : n.getMembers()) { 128 128 String s = ""; … … 152 152 RELATION_EMPTY, n) ); 153 153 } else { 154 LinkedList<String> done = new LinkedList< String>();154 LinkedList<String> done = new LinkedList<>(); 155 155 for (Role r : allroles) { 156 156 done.add(r.key); … … 180 180 if (ri != null) { 181 181 if (r.types != null) { 182 Set<OsmPrimitive> wrongTypes = new HashSet< OsmPrimitive>();182 Set<OsmPrimitive> wrongTypes = new HashSet<>(); 183 183 if (!r.types.contains(TaggingPresetType.WAY)) { 184 184 wrongTypes.addAll(r.types.contains(TaggingPresetType.CLOSEDWAY) ? ri.openways : ri.ways); … … 192 192 if (!wrongTypes.isEmpty()) { 193 193 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); 195 195 highlight.addFirst(n); 196 196 errors.add(new TestError(this, Severity.WARNING, ROLE_VERIF_PROBLEM_MSG, … … 200 200 } 201 201 if (r.memberExpression != null) { 202 Set<OsmPrimitive> notMatching = new HashSet< OsmPrimitive>();202 Set<OsmPrimitive> notMatching = new HashSet<>(); 203 203 for (Collection<OsmPrimitive> c : Arrays.asList(new Collection[]{ri.nodes, ri.ways, ri.relations})) { 204 204 for (OsmPrimitive p : c) { … … 210 210 if (!notMatching.isEmpty()) { 211 211 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); 213 213 highlight.addFirst(n); 214 214 errors.add(new TestError(this, Severity.WARNING, ROLE_VERIF_PROBLEM_MSG, -
trunk/src/org/openstreetmap/josm/data/validation/tests/SelfIntersectingWay.java
r6241 r7005 30 30 31 31 @Override public void visit(Way w) { 32 HashSet<Node> nodes = new HashSet< Node>();32 HashSet<Node> nodes = new HashSet<>(); 33 33 34 34 for (int i = 1; i < w.getNodesCount() - 1; i++) { -
trunk/src/org/openstreetmap/josm/data/validation/tests/SimilarNamedWays.java
r6240 r7005 46 46 public void startTest(ProgressMonitor monitor) { 47 47 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<>(); 50 50 } 51 51 … … 80 80 int levenshteinDistance = getLevenshteinDistance(name, name2); 81 81 if (0 < levenshteinDistance && levenshteinDistance <= 2) { 82 List<OsmPrimitive> primitives = new ArrayList< OsmPrimitive>(2);82 List<OsmPrimitive> primitives = new ArrayList<>(2); 83 83 primitives.add(w); 84 84 primitives.add(w2); -
trunk/src/org/openstreetmap/josm/data/validation/tests/TagChecker.java
r7004 r7005 75 75 protected static MultiMap<String, String> presetsValueData; 76 76 /** 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<>(); 82 82 83 83 /** The preferences prefix */ … … 161 161 ignoreDataKeyPair.clear(); 162 162 163 spellCheckKeyData = new HashMap< String, String>();163 spellCheckKeyData = new HashMap<>(); 164 164 165 165 String errorSources = ""; … … 258 258 Collection<TaggingPreset> presets = TaggingPresetPreference.taggingPresets; 259 259 if (presets != null) { 260 presetsValueData = new MultiMap< String, String>();260 presetsValueData = new MultiMap<>(); 261 261 for (String a : OsmPrimitive.getUninterestingKeys()) { 262 262 presetsValueData.putVoid(a); … … 316 316 public void check(OsmPrimitive p) { 317 317 // 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<>(); 319 319 320 320 if (checkComplex) { … … 550 550 @Override 551 551 public Command fixError(TestError testError) { 552 List<Command> commands = new ArrayList< Command>(50);552 List<Command> commands = new ArrayList<>(50); 553 553 554 554 Collection<? extends OsmPrimitive> primitives = testError.getPrimitives(); … … 607 607 protected static class CheckerData { 608 608 private String description; 609 protected List<CheckerElement> data = new ArrayList< CheckerElement>();609 protected List<CheckerElement> data = new ArrayList<>(); 610 610 private OsmPrimitiveType type; 611 611 private int code; -
trunk/src/org/openstreetmap/josm/data/validation/tests/TurnrestrictionTest.java
r6316 r7005 54 54 Way fromWay = null; 55 55 Way toWay = null; 56 List<OsmPrimitive> via = new ArrayList< OsmPrimitive>();56 List<OsmPrimitive> via = new ArrayList<>(); 57 57 58 58 boolean morefrom = false; … … 66 66 return; 67 67 68 List<OsmPrimitive> l = new ArrayList< OsmPrimitive>();68 List<OsmPrimitive> l = new ArrayList<>(); 69 69 l.add(r); 70 70 l.add(m.getMember()); -
trunk/src/org/openstreetmap/josm/data/validation/tests/UnclosedWays.java
r6916 r7005 156 156 */ 157 157 public Set<String> getCheckedKeys() { 158 Set<String> keys = new HashSet< String>();158 Set<String> keys = new HashSet<>(); 159 159 for (UnclosedWaysCheck c : checks) { 160 160 keys.add(c.key); -
trunk/src/org/openstreetmap/josm/data/validation/tests/UnconnectedWays.java
r6830 r7005 157 157 public void startTest(ProgressMonitor monitor) { 158 158 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<>(); 164 164 mindist = Main.pref.getDouble(PREFIX + ".node_way_distance", 10.0); 165 165 minmiddledist = Main.pref.getDouble(PREFIX + ".way_way_distance", 0.0); … … 168 168 169 169 protected Map<Node, Way> getWayEndNodesNearOtherHighway() { 170 Map<Node, Way> map = new HashMap< Node, Way>();170 Map<Node, Way> map = new HashMap<>(); 171 171 for (int iter = 0; iter < 1; iter++) { 172 172 for (MyWaySegment s : ways) { … … 199 199 200 200 protected Map<Node, Way> getWayEndNodesNearOtherWay() { 201 Map<Node, Way> map = new HashMap< Node, Way>();201 Map<Node, Way> map = new HashMap<>(); 202 202 for (MyWaySegment s : ways) { 203 203 if (isCanceled()) { … … 220 220 221 221 protected Map<Node, Way> getWayNodesNearOtherWay() { 222 Map<Node, Way> map = new HashMap< Node, Way>();222 Map<Node, Way> map = new HashMap<>(); 223 223 for (MyWaySegment s : ways) { 224 224 if (isCanceled()) { … … 240 240 241 241 protected Map<Node, Way> getConnectedWayEndNodesNearOtherWay() { 242 Map<Node, Way> map = new HashMap< Node, Way>();242 Map<Node, Way> map = new HashMap<>(); 243 243 for (MyWaySegment s : ways) { 244 244 if (isCanceled()) { … … 348 348 LatLon topLeft = new LatLon(y2+fudge, x1-fudge); 349 349 LatLon botRight = new LatLon(y1-fudge, x2+fudge); 350 List<LatLon> ret = new ArrayList< LatLon>(2);350 List<LatLon> ret = new ArrayList<>(2); 351 351 ret.add(topLeft); 352 352 ret.add(botRight); … … 368 368 // the nodes that are not in the smaller 369 369 // 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); 372 372 for (Node n : initial) { 373 373 if (!nearby(n, dist)) { … … 400 400 // allocating the hash set 401 401 if (nearbyNodeCache == null) { 402 nearbyNodeCache = new HashSet< Node>();402 nearbyNodeCache = new HashSet<>(); 403 403 } 404 404 nearbyNodeCache.add(n); … … 413 413 414 414 List<MyWaySegment> getWaySegments(Way w) { 415 List<MyWaySegment> ret = new ArrayList< MyWaySegment>();415 List<MyWaySegment> ret = new ArrayList<>(); 416 416 if (!w.isUsable() 417 417 || w.hasKey("barrier") -
trunk/src/org/openstreetmap/josm/data/validation/tests/UntaggedWay.java
r6494 r7005 42 42 43 43 /** 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<>(); 45 45 static { 46 46 NAMED_WAYS.add( "motorway" ); … … 54 54 55 55 /** 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<>(); 57 57 static { 58 58 WHITELIST.add( "outer" ); … … 119 119 public void startTest(ProgressMonitor monitor) { 120 120 super.startTest(monitor); 121 waysUsedInRelations = new HashSet< Way>();121 waysUsedInRelations = new HashSet<>(); 122 122 for (Relation r : Main.main.getCurrentDataSet().getRelations()) { 123 123 if (r.isUsable()) { -
trunk/src/org/openstreetmap/josm/data/validation/util/AggregatePrimitivesVisitor.java
r6010 r7005 21 21 public class AggregatePrimitivesVisitor extends AbstractVisitor { 22 22 /** Aggregated data */ 23 final Collection<OsmPrimitive> aggregatedData = new HashSet< OsmPrimitive>();23 final Collection<OsmPrimitive> aggregatedData = new HashSet<>(); 24 24 25 25 /** -
trunk/src/org/openstreetmap/josm/data/validation/util/Entities.java
r6920 r7005 386 386 if(mapNameToValue == null) 387 387 { 388 mapNameToValue = new HashMap< String, String>();388 mapNameToValue = new HashMap<>(); 389 389 for (String[] pair : ARRAY) 390 390 mapNameToValue.put(pair[0], pair[1]); -
trunk/src/org/openstreetmap/josm/data/validation/util/ValUtil.java
r6869 r7005 40 40 Node n2 = w.getNode(w.getNodesCount() - 1); 41 41 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<>(); 44 44 Point2D cell; 45 45 … … 55 55 List<Way> ways = cellWays.get(cell); 56 56 if (ways == null) { 57 ways = new ArrayList< Way>();57 ways = new ArrayList<>(); 58 58 cellWays.put(cell, ways); 59 59 } … … 66 66 ways = cellWays.get( cell ); 67 67 if (ways == null) { 68 ways = new ArrayList< Way>();68 ways = new ArrayList<>(); 69 69 cellWays.put(cell, ways); 70 70 } … … 84 84 ways = cellWays.get(cell); 85 85 if (ways == null) { 86 ways = new ArrayList< Way>();86 ways = new ArrayList<>(); 87 87 cellWays.put(cell, ways); 88 88 } … … 96 96 ways = cellWays.get(cell); 97 97 if (ways == null) { 98 ways = new ArrayList< Way>();98 ways = new ArrayList<>(); 99 99 cellWays.put(cell, ways); 100 100 } … … 134 134 CheckParameterUtil.ensureParameterNotNull(en1, "en1"); 135 135 CheckParameterUtil.ensureParameterNotNull(en2, "en2"); 136 List<Point2D> cells = new ArrayList< Point2D>();136 List<Point2D> cells = new ArrayList<>(); 137 137 double x0 = en1.east() * gridDetail; 138 138 double x1 = en2.east() * gridDetail;
Note:
See TracChangeset
for help on using the changeset viewer.