Replace .toList() with .collect()

.toList() was only introduced to android in api level 34, which is newer than
this module's min_sdk_version. Replace it with .collect().

This was found while updating android lint.

Flag: EXEMPT refactor
Bug: 394096385
Test: Presubmits
Change-Id: Id8d1de1531b67a7daf448e45592b7ef78f685fc2
This commit is contained in:
Cole Faust
2025-02-03 13:30:32 -08:00
parent b8fc998679
commit 1b9fd985d4
12 changed files with 42 additions and 24 deletions
@@ -222,7 +222,8 @@ public final class WidgetRecommendationsView extends PagedView<PageIndicatorDots
if (shouldShowFullPageView(recommendations)) {
// Show all widgets in single page with unlimited available height.
return setRecommendations(
recommendations.values().stream().flatMap(Collection::stream).toList(),
recommendations.values().stream().flatMap(Collection::stream)
.collect(Collectors.toList()),
deviceProfile, /*availableHeight=*/ Float.MAX_VALUE, availableWidth,
cellPadding);
@@ -369,7 +370,7 @@ public final class WidgetRecommendationsView extends PagedView<PageIndicatorDots
// Show only those widgets that were displayed when user first opened the picker.
if (!mDisplayedWidgets.isEmpty()) {
filteredRecommendedWidgets = recommendedWidgets.stream().filter(
w -> mDisplayedWidgets.contains(w.componentName)).toList();
w -> mDisplayedWidgets.contains(w.componentName)).collect(Collectors.toList());
}
Context context = getContext();
LayoutInflater inflater = LayoutInflater.from(context);