Changeset 12113 in josm for trunk/src/org


Ignore:
Timestamp:
2017-05-11T01:26:34+02:00 (8 years ago)
Author:
michael2402
Message:

See #13467: Preserve order of removed / added fields for selection events.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/osm/DataSelectionListener.java

    r12097 r12113  
    133133        public SelectionReplaceEvent(DataSet source, Set<OsmPrimitive> old, Stream<OsmPrimitive> newSelection) {
    134134            super(source, old);
    135             this.current = newSelection.collect(Collectors.toSet());
     135            this.current = newSelection.collect(Collectors.toCollection(LinkedHashSet::new));
    136136        }
    137137
     
    144144        public synchronized Set<OsmPrimitive> getRemoved() {
    145145            if (removed == null) {
    146                 removed = getOldSelection().stream().filter(p -> !current.contains(p)).collect(Collectors.toSet());
     146                removed = getOldSelection().stream()
     147                        .filter(p -> !current.contains(p))
     148                        .collect(Collectors.toCollection(LinkedHashSet::new));
    147149            }
    148150            return removed;
     
    152154        public synchronized Set<OsmPrimitive> getAdded() {
    153155            if (added == null) {
    154                 added = current.stream().filter(p -> !getOldSelection().contains(p)).collect(Collectors.toSet());
     156                added = current.stream()
     157                        .filter(p -> !getOldSelection().contains(p)).collect(Collectors.toCollection(LinkedHashSet::new));
    155158            }
    156159            return added;
     
    175178        public SelectionAddEvent(DataSet source, Set<OsmPrimitive> old, Stream<OsmPrimitive> toAdd) {
    176179            super(source, old);
    177             this.add = toAdd.filter(p -> !old.contains(p)).collect(Collectors.toSet());
     180            this.add = toAdd
     181                    .filter(p -> !old.contains(p))
     182                    .collect(Collectors.toCollection(LinkedHashSet::new));
    178183            if (this.add.isEmpty()) {
    179184                this.current = this.getOldSelection();
     
    217222        public SelectionRemoveEvent(DataSet source, Set<OsmPrimitive> old, Stream<OsmPrimitive> toRemove) {
    218223            super(source, old);
    219             this.remove = toRemove.filter(old::contains).collect(Collectors.toSet());
     224            this.remove = toRemove
     225                    .filter(old::contains)
     226                    .collect(Collectors.toCollection(LinkedHashSet::new));
    220227            if (this.remove.isEmpty()) {
    221228                this.current = this.getOldSelection();
Note: See TracChangeset for help on using the changeset viewer.