Ignore:
Timestamp:
2020-05-17T14:18:22+02:00 (4 years ago)
Author:
simon04
Message:

see #19251 - Java 8: use Stream

File:
1 edited

Legend:

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

    r14173 r16438  
    306306        if (menuItems != null && menuItems.length > 0) {
    307307
    308             int allItemsHeight = 0;
    309             for (Component item : menuItems) {
    310                 allItemsHeight += item.getPreferredSize().height;
    311             }
    312 
     308            int allItemsHeight = Arrays.stream(menuItems).mapToInt(item -> item.getPreferredSize().height).sum();
    313309            int allowedHeight = WindowGeometry.getMaxDimensionOnScreen(menu).height - MainApplication.getMainFrame().getInsets().top;
    314 
    315             boolean mustSCroll = allItemsHeight > allowedHeight;
    316 
    317             if (mustSCroll) {
     310            boolean mustScroll = allItemsHeight > allowedHeight;
     311            if (mustScroll) {
    318312                firstIndex = Math.min(menuItems.length-1, Math.max(topFixedCount, firstIndex));
    319313                int scrollCount = computeScrollCount(firstIndex);
Note: See TracChangeset for help on using the changeset viewer.