Changeset 15640 in josm for trunk/src/org/openstreetmap/josm/gui/tagging
- Timestamp:
- 2020-01-05T21:09:21+01:00 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPreset.java
r15029 r15640 23 23 import java.util.concurrent.CompletableFuture; 24 24 import java.util.function.Predicate; 25 import java.util.stream.Collectors; 25 26 26 27 import javax.swing.AbstractAction; … … 525 526 public Collection<OsmPrimitive> createSelection(Collection<OsmPrimitive> participants) { 526 527 originalSelectionEmpty = participants.isEmpty(); 527 Collection<OsmPrimitive> sel = new LinkedList<>(); 528 for (OsmPrimitive osm : participants) { 529 if (typeMatches(EnumSet.of(TaggingPresetType.forPrimitive(osm)))) { 530 sel.add(osm); 531 } 532 } 533 return sel; 528 return participants.stream().filter(this::typeMatches).collect(Collectors.toList()); 534 529 } 535 530 … … 540 535 public List<Tag> getChangedTags() { 541 536 List<Tag> result = new ArrayList<>(); 542 for (TaggingPresetItem i: data) { 543 i.addCommands(result); 544 } 537 data.forEach(i -> i.addCommands(result)); 545 538 return result; 546 539 } … … 585 578 public String toString() { 586 579 return (types == null ? "" : types.toString()) + ' ' + name; 580 } 581 582 /** 583 * Determines whether this preset matches the OSM primitive type. 584 * @param primitive The OSM primitive for which type must match 585 * @return <code>true</code> if type matches. 586 * @since 15640 587 */ 588 public final boolean typeMatches(IPrimitive primitive) { 589 return typeMatches(EnumSet.of(TaggingPresetType.forPrimitive(primitive))); 587 590 } 588 591
Note:
See TracChangeset
for help on using the changeset viewer.