Ignore:
Timestamp:
2016-08-03T15:01:43+02:00 (5 years ago)
Author:
simon04
Message:

see #11390, see #12890 - Deprecate Predicates class

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

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/tools/Predicates.java

    r10691 r10715  
    1111/**
    1212 * Utility class for creating {@link Predicate}s.
     13 * @deprecated Use corresponding lambda expressions instead
    1314 */
     15@Deprecated
    1416public final class Predicates {
    1517
     
    8789     */
    8890    public static Predicate<String> stringContainsPattern(final Pattern pattern) {
    89         return string -> pattern.matcher(string).find();
     91        return pattern.asPredicate();
    9092    }
    9193
     
    134136     */
    135137    public static <T> Predicate<T> isNull() {
    136         return object -> object == null;
     138        return Objects::isNull;
    137139    }
    138140
  • trunk/src/org/openstreetmap/josm/tools/Utils.java

    r10692 r10715  
    142142     */
    143143    public static <T> boolean exists(Iterable<T> collection, Class<? extends T> clazz) {
    144         return exists(collection, Predicates.<T>isInstanceOf(clazz));
     144        CheckParameterUtil.ensureParameterNotNull(clazz, "clazz");
     145        return exists(collection, clazz::isInstance);
    145146    }
    146147
     
    170171    @SuppressWarnings("unchecked")
    171172    public static <T> T find(Iterable<? extends Object> collection, Class<? extends T> clazz) {
    172         return (T) find(collection, Predicates.<Object>isInstanceOf(clazz));
     173        CheckParameterUtil.ensureParameterNotNull(clazz, "clazz");
     174        return (T) find(collection, clazz::isInstance);
    173175    }
    174176
     
    199201     */
    200202    public static <S, T extends S> SubclassFilteredCollection<S, T> filteredCollection(Collection<S> collection, final Class<T> clazz) {
    201         return new SubclassFilteredCollection<>(collection, Predicates.<S>isInstanceOf(clazz));
     203        CheckParameterUtil.ensureParameterNotNull(clazz, "clazz");
     204        return new SubclassFilteredCollection<>(collection, clazz::isInstance);
    202205    }
    203206
Note: See TracChangeset for help on using the changeset viewer.