Changeset 16450 in josm


Ignore:
Timestamp:
2020-05-17T18:01:01+02:00 (3 weeks ago)
Author:
simon04
Message:

see #19252 - Java 8: use Stream

Now including the previously missing filter(Objects::nonNull)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/widgets/MultiSplitLayout.java

    r16440 r16450  
    3636import java.util.ListIterator;
    3737import java.util.Map;
     38import java.util.Objects;
    3839
    3940import javax.swing.UIManager;
     
    777778        } else if (root instanceof Split) {
    778779            Split split = (Split) root;
    779             for (Node child : split.getChildren()) {
    780                 if (child.getBounds().contains(x, y))
    781                     return dividerAt(child, x, y);
    782             }
     780            return split.getChildren().stream()
     781                    .filter(child -> child.getBounds().contains(x, y))
     782                    .map(child -> dividerAt(child, x, y))
     783                    .filter(Objects::nonNull)
     784                    .findFirst().orElse(null);
    783785        }
    784786        return null;
Note: See TracChangeset for help on using the changeset viewer.