Changeset 15719 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2020-01-18T14:14:04+01:00 (5 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/preferences/sources/MapPaintPrefHelper.java
r15211 r15719 74 74 75 75 // XML style is not bundled anymore 76 list.remove(Utils.find(list, se -> "resource://styles/standard/elemstyles.xml".equals(se.url))); 76 list.stream() 77 .filter(se -> "resource://styles/standard/elemstyles.xml".equals(se.url)) 78 .findFirst() 79 .ifPresent(list::remove); 77 80 78 81 return changed; -
trunk/src/org/openstreetmap/josm/data/validation/tests/RelationChecker.java
r15680 r15719 34 34 import org.openstreetmap.josm.gui.tagging.presets.items.Roles; 35 35 import org.openstreetmap.josm.gui.tagging.presets.items.Roles.Role; 36 import org.openstreetmap.josm.tools.SubclassFilteredCollection; 36 37 import org.openstreetmap.josm.tools.Utils; 37 38 … … 173 174 for (TaggingPreset p : relationpresets) { 174 175 final boolean matches = TaggingPresetItem.matches(Utils.filteredCollection(p.data, KeyedItem.class), n.getKeys()); 175 final Roles r = Utils.find(p.data, Roles.class);176 if (matches && r != null) {177 for (Role role: r .roles) {176 final SubclassFilteredCollection<TaggingPresetItem, Roles> roles = Utils.filteredCollection(p.data, Roles.class); 177 if (matches && !roles.isEmpty()) { 178 for (Role role: roles.iterator().next().roles) { 178 179 allroles.put(role, p.name); 179 180 } -
trunk/src/org/openstreetmap/josm/gui/SplashScreen.java
r14153 r15719 15 15 import java.util.List; 16 16 import java.util.Objects; 17 import java.util.Optional; 17 18 import java.util.concurrent.CopyOnWriteArrayList; 18 19 … … 292 293 */ 293 294 public void finishTask(String title) { 294 final Task task = Utils.find(tasks, new MeasurableTask(title)::equals); 295 if (task instanceof MeasurableTask) { 295 Optional<Task> taskOptional = tasks.stream() 296 .filter(new MeasurableTask(title)::equals) 297 .filter(MeasurableTask.class::isInstance) 298 .findAny(); 299 taskOptional.ifPresent(task -> { 296 300 ((MeasurableTask) task).finish(); 297 301 if (Logging.isDebugEnabled()) { … … 299 303 } 300 304 listener.stateChanged(null); 301 } 305 }); 302 306 } 303 307 -
trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyles.java
r15097 r15719 41 41 import org.openstreetmap.josm.spi.preferences.PreferenceChangedListener; 42 42 import org.openstreetmap.josm.tools.Pair; 43 import org.openstreetmap.josm.tools.Utils;44 43 45 44 /** … … 194 193 } 195 194 if (!hasProperLineStyle) { 196 AreaElement area = Utils.find(p.a, AreaElement.class); 197 LineElement line = area == null ? LineElement.UNTAGGED_WAY : LineElement.createSimpleLineStyle(area.color, true); 195 LineElement line = LineElement.UNTAGGED_WAY; 196 for (StyleElement element : p.a) { 197 if (element instanceof AreaElement) { 198 line = LineElement.createSimpleLineStyle(((AreaElement) element).color, true); 199 break; 200 } 201 } 198 202 p.a = new StyleElementList(p.a, line); 199 203 } … … 288 292 break; 289 293 } else if (wayColor == null && isDefaultLines()) { 290 AreaElement mpArea = Utils.find(mpElemStyles.a, AreaElement.class); 291 if (mpArea != null) { 292 wayColor = mpArea.color; 294 for (StyleElement element : mpElemStyles.a) { 295 if (element instanceof AreaElement) { 296 wayColor = ((AreaElement) element).color; 297 break; 298 } 293 299 } 294 300 } -
trunk/src/org/openstreetmap/josm/tools/Utils.java
r15718 r15719 108 108 * @param clazz The class to search for. 109 109 * @return <code>true</code> if that item exists in the collection. 110 */ 110 * @deprecated use {@link Stream#anyMatch} 111 */ 112 @Deprecated 111 113 public static <T> boolean exists(Iterable<T> collection, Class<? extends T> clazz) { 112 114 CheckParameterUtil.ensureParameterNotNull(clazz, "clazz"); … … 120 122 * @param predicate The predicate to match 121 123 * @return the item or <code>null</code> if there was not match. 122 */ 124 * @deprecated use {@link Stream#filter} and {@link Stream#findFirst} 125 */ 126 @Deprecated 123 127 public static <T> T find(Iterable<? extends T> collection, Predicate<? super T> predicate) { 124 128 for (T item : collection) { … … 136 140 * @param clazz The class to search for. 137 141 * @return the item or <code>null</code> if there was not match. 138 */ 142 * @deprecated use {@link Stream#filter} and {@link Stream#findFirst} 143 */ 144 @Deprecated 139 145 @SuppressWarnings("unchecked") 140 146 public static <T> T find(Iterable<? extends Object> collection, Class<? extends T> clazz) {
Note:
See TracChangeset
for help on using the changeset viewer.