Changeset 10715 in josm for trunk/src/org/openstreetmap/josm/tools
- Timestamp:
- 2016-08-03T15:01:43+02:00 (9 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/tools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/Predicates.java
r10691 r10715 11 11 /** 12 12 * Utility class for creating {@link Predicate}s. 13 * @deprecated Use corresponding lambda expressions instead 13 14 */ 15 @Deprecated 14 16 public final class Predicates { 15 17 … … 87 89 */ 88 90 public static Predicate<String> stringContainsPattern(final Pattern pattern) { 89 return string ->pattern.matcher(string).find();91 return pattern.asPredicate(); 90 92 } 91 93 … … 134 136 */ 135 137 public static <T> Predicate<T> isNull() { 136 return object -> object == null;138 return Objects::isNull; 137 139 } 138 140 -
trunk/src/org/openstreetmap/josm/tools/Utils.java
r10692 r10715 142 142 */ 143 143 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); 145 146 } 146 147 … … 170 171 @SuppressWarnings("unchecked") 171 172 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); 173 175 } 174 176 … … 199 201 */ 200 202 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); 202 205 } 203 206
Note:
See TracChangeset
for help on using the changeset viewer.