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: I71fd1435b7645ea4f1f653c05fef1ddc47adbc14
Merged-In: Id8d1de1531b67a7daf448e45592b7ef78f685fc2
This commit is contained in:
Cole Faust committed 2025-02-03 14:19:57 -08:00
1 parent 8a281b4ef8
commit ad78da873d
10 files changed
+35 -20

No files matched your search

@@ -41,6 +41,7 @@ import com.android.launcher3.widget.picker.util.WidgetPreviewContainerSize;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/** A {@link TableLayout} for showing recommended widgets. */
public final class WidgetsRecommendationTableLayout extends TableLayout {
@@ -163,6 +164,7 @@ public final class WidgetsRecommendationTableLayout extends TableLayout {
}
// Perform re-ordering once we have filtered out recommendations that fit.
return filteredRows.stream().sorted(WIDGETS_TABLE_ROW_COUNT_COMPARATOR).toList();
return filteredRows.stream().sorted(WIDGETS_TABLE_ROW_COUNT_COMPARATOR)
.collect(Collectors.toList());
}
}