Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ea924944 authored by Chalard Jean's avatar Chalard Jean Committed by Android (Google) Code Review
Browse files

Merge "Use filter from CollectionUtils." into sc-dev

parents 4f5a1176 dcdd357d
Loading
Loading
Loading
Loading
+1 −12
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import static android.net.NetworkScore.POLICY_EXITING;
import static android.net.NetworkScore.POLICY_TRANSPORT_PRIMARY;
import static android.net.NetworkScore.POLICY_YIELD_TO_BAD_WIFI;

import static com.android.net.module.util.CollectionUtils.filter;
import static com.android.server.connectivity.FullScore.POLICY_ACCEPT_UNVALIDATED;
import static com.android.server.connectivity.FullScore.POLICY_EVER_USER_SELECTED;
import static com.android.server.connectivity.FullScore.POLICY_EVER_VALIDATED_NOT_AVOIDED_WHEN_BAD;
@@ -66,18 +67,6 @@ public class NetworkRanker {

    public NetworkRanker() { }

    // TODO : move to module utils CollectionUtils.
    @NonNull private static <T> ArrayList<T> filter(@NonNull final Collection<T> source,
            @NonNull final Predicate<T> test) {
        final ArrayList<T> matches = new ArrayList<>();
        for (final T e : source) {
            if (test.test(e)) {
                matches.add(e);
            }
        }
        return matches;
    }

    /**
     * Find the best network satisfying this request among the list of passed networks.
     */