Ignore:
Timestamp:
2016-07-27T02:08:34+02:00 (8 years ago)
Author:
Don-vip
Message:

see #11390, see #12890 - use Java 8 Predicates

Location:
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/Condition.java

    r10607 r10657  
    1111import java.util.Objects;
    1212import java.util.Set;
     13import java.util.function.Predicate;
    1314import java.util.regex.Pattern;
    1415
     
    2627import org.openstreetmap.josm.gui.mappaint.Environment;
    2728import org.openstreetmap.josm.tools.CheckParameterUtil;
    28 import org.openstreetmap.josm.tools.Predicate;
    2929import org.openstreetmap.josm.tools.Predicates;
     30import org.openstreetmap.josm.tools.SubclassFilteredCollection;
    3031import org.openstreetmap.josm.tools.Utils;
    3132
     
    463464                    return e.osm.isKeyFalse(label) ^ negateResult;
    464465                case REGEX:
    465                     return Utils.exists(e.osm.keySet(), containsPattern) ^ negateResult;
     466                    return e.osm.keySet().stream().anyMatch(containsPattern) ^ negateResult;
    466467                default:
    467468                    return e.osm.hasKey(label) ^ negateResult;
     
    486487            String key = label;
    487488            if (KeyMatchType.REGEX.equals(matchType)) {
    488                 final Collection<String> matchingKeys = Utils.filter(p.keySet(), containsPattern);
     489                final Collection<String> matchingKeys = SubclassFilteredCollection.filter(p.keySet(), containsPattern);
    489490                if (!matchingKeys.isEmpty()) {
    490491                    key = matchingKeys.iterator().next();
     
    666667         */
    667668        static boolean inDownloadedArea(Environment e) { // NO_UCD (unused code)
    668             return IN_DOWNLOADED_AREA.evaluate(e.osm);
     669            return IN_DOWNLOADED_AREA.test(e.osm);
    669670        }
    670671
  • trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/ExpressionFactory.java

    r10627 r10657  
    3838import org.openstreetmap.josm.tools.Predicates;
    3939import org.openstreetmap.josm.tools.RightAndLefthandTraffic;
     40import org.openstreetmap.josm.tools.SubclassFilteredCollection;
    4041import org.openstreetmap.josm.tools.Utils;
    4142import org.openstreetmap.josm.tools.Utils.Function;
     
    11341135        public Float aggregateList(List<?> lst) {
    11351136            final List<Float> floats = Utils.transform(lst, (Function<Object, Float>) x -> Cascade.convertTo(x, float.class));
    1136             final Collection<Float> nonNullList = Utils.filter(floats, Predicates.not(Predicates.isNull()));
     1137            final Collection<Float> nonNullList = SubclassFilteredCollection.filter(floats, Predicates.not(Predicates.isNull()));
    11371138            return nonNullList.isEmpty() ? (Float) Float.NaN : computeMax ? Collections.max(nonNullList) : Collections.min(nonNullList);
    11381139        }
  • trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/Selector.java

    r10627 r10657  
    2525import org.openstreetmap.josm.tools.Pair;
    2626import org.openstreetmap.josm.tools.Predicates;
     27import org.openstreetmap.josm.tools.SubclassFilteredCollection;
    2728import org.openstreetmap.josm.tools.Utils;
    2829
     
    320321                        throw new NoSuchElementException();
    321322                    }
    322                     final Collection<Relation> multipolygons = Utils.filteredCollection(Utils.filter(
     323                    final Collection<Relation> multipolygons = Utils.filteredCollection(SubclassFilteredCollection.filter(
    323324                            e.osm.getReferrers(), Predicates.hasTag("type", "multipolygon")), Relation.class);
    324325                    final Relation multipolygon = multipolygons.iterator().next();
Note: See TracChangeset for help on using the changeset viewer.