Changeset 16415 in josm for trunk/src/org/openstreetmap


Ignore:
Timestamp:
2020-05-15T22:39:16+02:00 (5 years ago)
Author:
simon04
Message:

Java 8: use Stream.anyMatch

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/preferences/ToolbarPreferences.java

    r16414 r16415  
    593593            @SuppressWarnings("unchecked")
    594594            protected Transferable createTransferable(JComponent c) {
    595                 List<ActionDefinition> actions = new ArrayList<>();
    596                 for (ActionDefinition o: ((JList<ActionDefinition>) c).getSelectedValuesList()) {
    597                     actions.add(o);
    598                 }
     595                List<ActionDefinition> actions = new ArrayList<>(((JList<ActionDefinition>) c).getSelectedValuesList());
    599596                return new ActionTransferable(actions);
    600597            }
     
    607604            @Override
    608605            public boolean canImport(JComponent comp, DataFlavor[] transferFlavors) {
    609                 for (DataFlavor f : transferFlavors) {
    610                     if (ACTION_FLAVOR.equals(f))
    611                         return true;
    612                 }
    613                 return false;
     606                return Arrays.stream(transferFlavors).anyMatch(ACTION_FLAVOR::equals);
    614607            }
    615608
Note: See TracChangeset for help on using the changeset viewer.