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:
@@ -26,6 +26,7 @@ import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Contains the logic of a reorder.
|
||||
@@ -143,12 +144,14 @@ public class ReorderAlgorithm {
|
||||
// and not by the views hash which is "random".
|
||||
// The views are sorted twice, once for the X position and a second time for the Y position
|
||||
// to ensure same order everytime.
|
||||
Comparator comparator = Comparator.comparing(
|
||||
view -> ((CellLayoutLayoutParams) ((View) view).getLayoutParams()).getCellX()
|
||||
Comparator<View> comparator = Comparator.comparing(
|
||||
(View view) -> ((CellLayoutLayoutParams) view.getLayoutParams()).getCellX()
|
||||
).thenComparing(
|
||||
view -> ((CellLayoutLayoutParams) ((View) view).getLayoutParams()).getCellY()
|
||||
(View view) -> ((CellLayoutLayoutParams) view.getLayoutParams()).getCellY()
|
||||
);
|
||||
List<View> views = solution.map.keySet().stream().sorted(comparator).toList();
|
||||
List<View> views = solution.map.keySet().stream()
|
||||
.sorted(comparator)
|
||||
.collect(Collectors.toList());
|
||||
for (View child : views) {
|
||||
if (child == ignoreView) continue;
|
||||
CellAndSpan c = solution.map.get(child);
|
||||
|
||||
Reference in New Issue
Block a user