Changeset 11339 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2016-11-28T21:18:55+01:00 (8 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/Main.java
r11284 r11339 1092 1092 if (listener == null) return; 1093 1093 synchronized (Main.class) { 1094 Iterator<WeakReference<ProjectionChangeListener>> it = listeners.iterator(); 1095 while (it.hasNext()) { 1096 WeakReference<ProjectionChangeListener> wr = it.next(); 1097 // remove the listener - and any other listener which got garbage 1098 // collected in the meantime 1099 if (wr.get() == null || wr.get() == listener) { 1100 it.remove(); 1101 } 1102 } 1094 // remove the listener - and any other listener which got garbage 1095 // collected in the meantime 1096 listeners.removeIf(wr -> wr.get() == null || wr.get() == listener); 1103 1097 } 1104 1098 } … … 1156 1150 if (listener == null) return; 1157 1151 synchronized (Main.class) { 1158 Iterator<WeakReference<WindowSwitchListener>> it = windowSwitchListeners.iterator(); 1159 while (it.hasNext()) { 1160 WeakReference<WindowSwitchListener> wr = it.next(); 1161 // remove the listener - and any other listener which got garbage 1162 // collected in the meantime 1163 if (wr.get() == null || wr.get() == listener) { 1164 it.remove(); 1165 } 1166 } 1152 // remove the listener - and any other listener which got garbage 1153 // collected in the meantime 1154 windowSwitchListeners.removeIf(wr -> wr.get() == null || wr.get() == listener); 1167 1155 if (windowSwitchListeners.isEmpty()) { 1168 1156 MasterWindowListener.teardown(); -
trunk/src/org/openstreetmap/josm/actions/AbstractInfoAction.java
r10383 r11339 8 8 import java.util.ArrayList; 9 9 import java.util.Collection; 10 import java.util.Iterator;11 10 import java.util.List; 12 11 … … 15 14 import org.openstreetmap.josm.Main; 16 15 import org.openstreetmap.josm.data.notes.Note; 16 import org.openstreetmap.josm.data.osm.AbstractPrimitive; 17 17 import org.openstreetmap.josm.data.osm.DataSet; 18 18 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 109 109 // filter out new primitives which are not yet uploaded to the server 110 110 // 111 Iterator<OsmPrimitive> it = primitivesToShow.iterator(); 112 while (it.hasNext()) { 113 if (it.next().isNew()) { 114 it.remove(); 115 } 116 } 111 primitivesToShow.removeIf(AbstractPrimitive::isNew); 117 112 118 113 if (primitivesToShow.isEmpty() && noteToShow == null) { -
trunk/src/org/openstreetmap/josm/actions/UnJoinNodeWayAction.java
r10467 r11339 10 10 import java.util.ArrayList; 11 11 import java.util.Collection; 12 import java.util.Iterator;13 12 import java.util.LinkedList; 14 13 import java.util.List; … … 156 155 for (int i = 1; i < selectedNodes.size(); i++) { 157 156 List<OsmPrimitive> ref = selectedNodes.get(i).getReferrers(); 158 for (Iterator<Way> it = result.iterator(); it.hasNext();) { 159 if (!ref.contains(it.next())) { 160 it.remove(); 161 } 162 } 157 result.removeIf(way -> !ref.contains(way)); 163 158 } 164 159 165 160 // Remove broken ways 166 for (Iterator<Way> it = result.iterator(); it.hasNext();) { 167 if (it.next().getNodesCount() <= 2) { 168 it.remove(); 169 } 170 } 161 result.removeIf(way -> way.getNodesCount() <= 2); 171 162 172 163 if (selectedWays.isEmpty()) … … 174 165 else { 175 166 // Return only selected ways 176 for (Iterator<Way> it = result.iterator(); it.hasNext();) { 177 if (!selectedWays.contains(it.next())) { 178 it.remove(); 179 } 180 } 167 result.removeIf(way -> !selectedWays.contains(way)); 181 168 return result; 182 169 } -
trunk/src/org/openstreetmap/josm/command/DeleteCommand.java
r11240 r11339 14 14 import java.util.HashMap; 15 15 import java.util.HashSet; 16 import java.util.Iterator;17 16 import java.util.LinkedList; 18 17 import java.util.List; … … 439 438 if (!silent) { 440 439 Set<RelationToChildReference> references = RelationToChildReference.getRelationToChildReferences(primitivesToDelete); 441 Iterator<RelationToChildReference> it = references.iterator(); 442 while (it.hasNext()) { 443 RelationToChildReference ref = it.next(); 444 if (ref.getParent().isDeleted()) { 445 it.remove(); 446 } 447 } 440 references.removeIf(ref -> ref.getParent().isDeleted()); 448 441 if (!references.isEmpty()) { 449 442 DeleteFromRelationConfirmationDialog dialog = DeleteFromRelationConfirmationDialog.getInstance(); -
trunk/src/org/openstreetmap/josm/data/CustomConfigurator.java
r10608 r11339 1088 1088 } 1089 1089 } 1090 Iterator<Map.Entry<String, Setting<?>>> it = tmpPref.settingsMap.entrySet().iterator(); 1091 while (it.hasNext()) { 1092 Map.Entry<String, Setting<?>> e = it.next(); 1093 if (e.getValue().getValue() == null) { 1094 it.remove(); 1095 } 1096 } 1090 tmpPref.settingsMap.entrySet().removeIf(e -> e.getValue().getValue() == null); 1097 1091 1098 1092 for (Map.Entry<String, Setting<?>> e: tmpPref.settingsMap.entrySet()) { -
trunk/src/org/openstreetmap/josm/data/osm/TagCollection.java
r11097 r11339 291 291 public void removeByKey(String key) { 292 292 if (key != null) { 293 Iterator<Tag> it = tags.keySet().iterator(); 294 while (it.hasNext()) { 295 if (it.next().matchesKey(key)) { 296 it.remove(); 297 } 298 } 293 tags.keySet().removeIf(tag -> tag.matchesKey(key)); 299 294 } 300 295 } -
trunk/src/org/openstreetmap/josm/data/validation/tests/Addresses.java
r11129 r11339 9 9 import java.util.HashMap; 10 10 import java.util.HashSet; 11 import java.util.Iterator;12 11 import java.util.List; 13 12 import java.util.Locale; … … 59 58 protected List<Relation> getAndCheckAssociatedStreets(OsmPrimitive p) { 60 59 List<Relation> list = OsmPrimitive.getFilteredList(p.getReferrers(), Relation.class); 61 for (Iterator<Relation> it = list.iterator(); it.hasNext();) { 62 Relation r = it.next(); 63 if (!r.hasTag("type", ASSOCIATED_STREET)) { 64 it.remove(); 65 } 66 } 60 list.removeIf(r -> !r.hasTag("type", ASSOCIATED_STREET)); 67 61 if (list.size() > 1) { 68 62 Severity level; -
trunk/src/org/openstreetmap/josm/data/validation/tests/DuplicateNode.java
r11268 r11339 21 21 import org.openstreetmap.josm.command.Command; 22 22 import org.openstreetmap.josm.data.coor.LatLon; 23 import org.openstreetmap.josm.data.osm.AbstractPrimitive; 23 24 import org.openstreetmap.josm.data.osm.Hash; 24 25 import org.openstreetmap.josm.data.osm.Node; … … 315 316 316 317 // Filter nodes that have already been deleted (see #5764 and #5773) 317 for (Iterator<Node> it = nodes.iterator(); it.hasNext();) { 318 if (it.next().isDeleted()) { 319 it.remove(); 320 } 321 } 318 nodes.removeIf(AbstractPrimitive::isDeleted); 322 319 323 320 // Merge only if at least 2 nodes remain -
trunk/src/org/openstreetmap/josm/gui/dialogs/properties/RecentTagCollection.java
r9981 r11339 64 64 public void setTagsToIgnore(SearchCompiler.Match tagsToIgnore) { 65 65 this.tagsToIgnore = tagsToIgnore; 66 final Iterator<Tag> it = recentTags.keySet().iterator(); 67 while (it.hasNext()) { 68 if (tagsToIgnore.match(it.next())) { 69 it.remove(); 70 } 71 } 66 recentTags.keySet().removeIf(tagsToIgnore::match); 72 67 } 73 68 -
trunk/src/org/openstreetmap/josm/gui/dialogs/properties/TagEditHelper.java
r11304 r11339 33 33 import java.util.Comparator; 34 34 import java.util.HashMap; 35 import java.util.Iterator;36 35 import java.util.List; 37 36 import java.util.Map; … … 687 686 688 687 // remove the object's tag keys from the list 689 Iterator<AutoCompletionListItem> iter = keyList.iterator(); 690 while (iter.hasNext()) { 691 AutoCompletionListItem item = iter.next(); 692 if (containsDataKey(item.getValue())) { 693 iter.remove(); 694 } 695 } 688 keyList.removeIf(item -> containsDataKey(item.getValue())); 696 689 697 690 keyList.sort(defaultACItemComparator); -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/MemberTableModel.java
r10777 r11339 9 9 import java.util.EnumSet; 10 10 import java.util.HashSet; 11 import java.util.Iterator;12 11 import java.util.List; 13 12 import java.util.Set; … … 349 348 if (primitives == null) 350 349 return; 351 Iterator<RelationMember> it = members.iterator(); 352 while (it.hasNext()) { 353 RelationMember member = it.next(); 354 if (primitives.contains(member.getMember())) { 355 it.remove(); 356 } 357 } 350 members.removeIf(member -> primitives.contains(member.getMember())); 358 351 fireTableDataChanged(); 359 352 } -
trunk/src/org/openstreetmap/josm/gui/preferences/plugin/PluginPreference.java
r11198 r11339 20 20 import java.util.Collection; 21 21 import java.util.Collections; 22 import java.util.Iterator;23 22 import java.util.LinkedList; 24 23 import java.util.List; … … 430 429 // select plugins which actually have to be updated 431 430 // 432 Iterator<PluginInformation> it = toUpdate.iterator(); 433 while (it.hasNext()) { 434 PluginInformation pi = it.next(); 435 if (!pi.isUpdateRequired()) { 436 it.remove(); 437 } 438 } 431 toUpdate.removeIf(pi -> !pi.isUpdateRequired()); 439 432 if (toUpdate.isEmpty()) { 440 433 alertNothingToUpdate(); -
trunk/src/org/openstreetmap/josm/plugins/PluginHandler.java
r11288 r11339 547 547 // Build list of plugins to download 548 548 Set<PluginInformation> toDownload = new HashSet<>(pluginInfoDownloadTask.getAvailablePlugins()); 549 for (Iterator<PluginInformation> it = toDownload.iterator(); it.hasNext();) { 550 PluginInformation info = it.next(); 551 if (!missingRequiredPlugin.contains(info.getName())) { 552 it.remove(); 553 } 554 } 549 toDownload.removeIf(info -> !missingRequiredPlugin.contains(info.getName())); 555 550 // Check if something has still to be downloaded 556 551 if (!toDownload.isEmpty()) {
Note:
See TracChangeset
for help on using the changeset viewer.