Changeset 12549 in josm for trunk


Ignore:
Timestamp:
2017-07-31T23:34:29+02:00 (7 years ago)
Author:
Don-vip
Message:

sonar - squid:S4034 - "Stream.anyMatch()" should be preferred

Location:
trunk/src/org/openstreetmap/josm
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/osm/TagCollection.java

    r11339 r12549  
    377377     */
    378378    public boolean hasValuesFor(String key) {
    379         return generateStreamForKey(key).filter(t -> !t.getValue().isEmpty()).findAny().isPresent();
     379        return generateStreamForKey(key).anyMatch(t -> !t.getValue().isEmpty());
    380380    }
    381381
  • trunk/src/org/openstreetmap/josm/gui/dialogs/properties/TagEditHelper.java

    r12523 r12549  
    206206    private boolean containsDataKey(String key) {
    207207        return IntStream.range(0, tagData.getRowCount())
    208                 .filter(i -> key.equals(tagData.getValueAt(i, 0)) /* sic! do not use getDataKey*/
    209                     && !((Map<String, Integer>) tagData.getValueAt(i, 1)).containsKey("") /* sic! do not use getDataValues*/)
    210                 .findAny().isPresent();
     208                .anyMatch(i -> key.equals(tagData.getValueAt(i, 0)) /* sic! do not use getDataKey*/
     209                    && !((Map<String, Integer>) tagData.getValueAt(i, 1)).containsKey("") /* sic! do not use getDataValues*/);
    211210    }
    212211
Note: See TracChangeset for help on using the changeset viewer.