Ignore:
Timestamp:
2020-05-20T22:51:46+02:00 (4 years ago)
Author:
simon04
Message:

Java 8: use Collection.removeIf

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/RelationDialogManager.java

    r16438 r16468  
    108108    public void updateContext(OsmDataLayer layer, Relation relation, RelationEditor editor) {
    109109        // lookup the entry for editor and remove it
    110         for (Iterator<Entry<DialogContext, RelationEditor>> it = openDialogs.entrySet().iterator(); it.hasNext();) {
    111             Entry<DialogContext, RelationEditor> entry = it.next();
    112             if (Objects.equals(entry.getValue(), editor)) {
    113                 it.remove();
    114                 break;
    115             }
    116         }
     110        openDialogs.values().removeIf(i -> Objects.equals(i, editor));
    117111        // don't add a window listener. Editor is already known to the relation dialog manager
    118112        openDialogs.put(new DialogContext(layer, relation), editor);
     
    199193        if (w instanceof RelationEditor) {
    200194            RelationEditor editor = (RelationEditor) w;
    201             for (Iterator<Entry<DialogContext, RelationEditor>> it = openDialogs.entrySet().iterator(); it.hasNext();) {
    202                 if (editor.equals(it.next().getValue())) {
    203                     it.remove();
    204                     break;
    205                 }
    206             }
     195            openDialogs.values().removeIf(i -> Objects.equals(i, editor));
    207196        }
    208197    }
Note: See TracChangeset for help on using the changeset viewer.