Ticket #20395: 20395.patch

File 20395.patch, 2.6 KB (added by GerdP, 3 months ago)

use concurrent.CopyOnWriteArrayList instead of ArrayList

  • src/org/openstreetmap/josm/data/conflict/ConflictCollection.java

     
    33
    44import static org.openstreetmap.josm.tools.I18n.tr;
    55
    6 import java.util.ArrayList;
    76import java.util.Collection;
    87import java.util.Iterator;
    98import java.util.List;
     
    3837 * </ul>
    3938 */
    4039public class ConflictCollection implements Iterable<Conflict<? extends OsmPrimitive>> {
    41     private final List<Conflict<? extends OsmPrimitive>> conflicts;
     40    private final CopyOnWriteArrayList<Conflict<? extends OsmPrimitive>> conflicts;
    4241    private final CopyOnWriteArrayList<IConflictListener> listeners;
    4342
    4443    /**
     
    4544     * Constructs a new {@code ConflictCollection}.
    4645     */
    4746    public ConflictCollection() {
    48         conflicts = new ArrayList<>();
     47        conflicts = new CopyOnWriteArrayList<>();
    4948        listeners = new CopyOnWriteArrayList<>();
    5049    }
    5150
     
    326325    }
    327326
    328327    /**
    329      * Returns the list of conflicts involving nodes.
    330      * @return The list of conflicts involving nodes.
     328     * Returns the list of conflicts involving ways.
     329     * @return The list of conflicts involving ways.
    331330     * @since 6555
    332331     */
    333332    public final Collection<Conflict<? extends OsmPrimitive>> getWayConflicts() {
     
    335334    }
    336335
    337336    /**
    338      * Returns the list of conflicts involving nodes.
    339      * @return The list of conflicts involving nodes.
     337     * Returns the list of conflicts involving relations.
     338     * @return The list of conflicts involving relations.
    340339     * @since 6555
    341340     */
    342341    public final Collection<Conflict<? extends OsmPrimitive>> getRelationConflicts() {
  • src/org/openstreetmap/josm/gui/dialogs/ConflictDialog.java

     
    223223     */
    224224    public void refreshView() {
    225225        DataSet editDs = MainApplication.getLayerManager().getEditDataSet();
    226         synchronized (this) {
    227             conflicts = editDs == null ? new ConflictCollection() : editDs.getConflicts();
    228         }
     226        conflicts = editDs == null ? new ConflictCollection() : editDs.getConflicts();
    229227        GuiHelper.runInEDT(() -> {
    230228            model.fireContentChanged();
    231229            updateTitle();