- Timestamp:
- 2018-09-09T23:10:41+02:00 (6 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/OsmUtils.java
r13957 r14238 7 7 import java.util.Locale; 8 8 import java.util.Map; 9 import java.util.Objects;10 9 import java.util.Set; 11 10 … … 165 164 */ 166 165 public static boolean isOsmCollectionEditable(Collection<? extends IPrimitive> collection) { 167 return collection != null && !collection.isEmpty() 168 && collection.stream().map(IPrimitive::getDataSet).filter(Objects::nonNull).noneMatch(OsmData::isLocked); 166 if (collection == null || collection.isEmpty()) { 167 return false; 168 } 169 // see #16510: optimization: only consider the first primitive, as collection always refer to the same dataset 170 OsmData<?, ?, ?, ?> ds = collection.iterator().next().getDataSet(); 171 return ds == null || !ds.isLocked(); 169 172 } 170 173 } -
trunk/src/org/openstreetmap/josm/tools/ImageProvider.java
r14214 r14238 34 34 import java.util.Base64; 35 35 import java.util.Collection; 36 import java.util.Collections; 36 37 import java.util.HashMap; 37 38 import java.util.HashSet; … … 270 271 } 271 272 273 /** small cache of critical images used in many parts of the application */ 274 private static final Map<OsmPrimitiveType, ImageIcon> osmPrimitiveTypeCache = Collections.synchronizedMap(new HashMap<>()); 275 272 276 /** directories in which images are searched */ 273 277 protected Collection<String> dirs; … … 1474 1478 public static ImageIcon get(OsmPrimitiveType type) { 1475 1479 CheckParameterUtil.ensureParameterNotNull(type, "type"); 1476 return get("data", type.getAPIName());1480 return osmPrimitiveTypeCache.computeIfAbsent(type, t -> get("data", t.getAPIName())); 1477 1481 } 1478 1482
Note:
See TracChangeset
for help on using the changeset viewer.