Merge "Use filter from CollectionUtils." into sc-dev
This commit is contained in:
@@ -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_TRANSPORT_PRIMARY;
|
||||||
import static android.net.NetworkScore.POLICY_YIELD_TO_BAD_WIFI;
|
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_ACCEPT_UNVALIDATED;
|
||||||
import static com.android.server.connectivity.FullScore.POLICY_EVER_USER_SELECTED;
|
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;
|
import static com.android.server.connectivity.FullScore.POLICY_EVER_VALIDATED_NOT_AVOIDED_WHEN_BAD;
|
||||||
@@ -66,18 +67,6 @@ public class NetworkRanker {
|
|||||||
|
|
||||||
public 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.
|
* Find the best network satisfying this request among the list of passed networks.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user