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

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

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

Legend:

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

    r7395 r10657  
    1717     * @param predicate The predicate to use as filter
    1818     */
    19     public FilteredCollection(Collection<? extends T> collection, Predicate<? super T> predicate) {
     19    public FilteredCollection(Collection<? extends T> collection, java.util.function.Predicate<? super T> predicate) {
    2020        super(collection, predicate);
    2121    }
  • trunk/src/org/openstreetmap/josm/tools/SubclassFilteredCollection.java

    r10584 r10657  
    120120     * @return The filtered collection. It is a {@code Collection<T>}.
    121121     */
    122     public static <T> SubclassFilteredCollection<T, T> filter(Collection<T> collection, java.util.function.Predicate<T> predicate) {
     122    public static <T> SubclassFilteredCollection<T, T> filter(Collection<? extends T> collection, java.util.function.Predicate<T> predicate) {
    123123        return new SubclassFilteredCollection<>(collection, predicate);
    124124    }
  • trunk/src/org/openstreetmap/josm/tools/Utils.java

    r10638 r10657  
    102102     * Tests whether {@code predicate} applies to at least one element from {@code collection}.
    103103     * <p>
    104      * Note: you can use {@link Stream#anyMatch(java.util.function.Predicate)} instead.
    105104     * @param <T> type of items
    106105     * @param collection the collection
    107106     * @param predicate the predicate
    108107     * @return {@code true} if {@code predicate} applies to at least one element from {@code collection}
    109      */
     108     * @deprecated use {@link Stream#anyMatch(java.util.function.Predicate)} instead.
     109     */
     110    @Deprecated
    110111    public static <T> boolean exists(Iterable<? extends T> collection, Predicate<? super T> predicate) {
    111112        for (T item : collection) {
     
    120121     * Tests whether {@code predicate} applies to all elements from {@code collection}.
    121122     * <p>
    122      * Note: you can use {@link Stream#allMatch(java.util.function.Predicate)} instead.
    123123     * @param <T> type of items
    124124     * @param collection the collection
    125125     * @param predicate the predicate
    126126     * @return {@code true} if {@code predicate} applies to all elements from {@code collection}
    127      */
     127     * @deprecated use {@link Stream#allMatch(java.util.function.Predicate)} instead.
     128     */
     129    @Deprecated
    128130    public static <T> boolean forAll(Iterable<? extends T> collection, Predicate<? super T> predicate) {
    129131        return !exists(collection, Predicates.not(predicate));
Note: See TracChangeset for help on using the changeset viewer.