Cleanup: use Stream.toList()

Replaces Stream.collect(Collection.toList() | Collectors.toCollection()).
This commit is contained in:
Dennis Guse
2025-10-19 18:25:01 +02:00
parent ddd1efeb58
commit 1a1a8a851b
11 changed files with 28 additions and 26 deletions
@@ -829,7 +829,8 @@ public class PreferencesUtils {
R.array.stats_custom_layout_fields_default_value_16,
R.array.stats_custom_layout_fields_default_value_17,
R.array.stats_custom_layout_fields_default_value_18
).map(id -> resources.obtainTypedArray(id)).collect(Collectors.toList());
).map(id -> resources.obtainTypedArray(id))
.toList();
}
@SuppressLint("ResourceType")
@@ -904,7 +905,9 @@ public class PreferencesUtils {
}
public static List<String> getAllCustomLayoutNames() {
return getAllCustomLayouts().stream().map(RecordingLayout::getName).collect(Collectors.toList());
return getAllCustomLayouts().stream()
.map(RecordingLayout::getName)
.toList();
}
public static void resetCustomLayoutPreferences() {
@@ -24,7 +24,6 @@ import androidx.vectordrawable.graphics.drawable.AnimatedVectorDrawableCompat;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import de.dennisguse.opentracks.R;
import de.dennisguse.opentracks.sensors.BluetoothUtils;
@@ -126,7 +125,7 @@ public abstract class BluetoothLeSensorPreference extends DialogPreference {
@Override
public void onBatchScanResults(List<ScanResult> results) {
listAdapter.addAll(results.stream().map(ScanResult::getDevice).collect(Collectors.toList()));
listAdapter.addAll(results.stream().map(ScanResult::getDevice).toList());
}
@Override
@@ -149,7 +148,7 @@ public abstract class BluetoothLeSensorPreference extends DialogPreference {
b.putParcelableArrayList(ARG_BLE_SERVICE_UUIDS, new ArrayList<>(sensorUUIDs.stream()
.map(ServiceMeasurementUUID::serviceUUID)
.map(ParcelUuid::new)
.collect(Collectors.toList())));
.toList()));
b.putBoolean(ARG_INCLUDE_INTERNAL, includeInternalSensor);
fragment.setArguments(b);
@@ -224,7 +223,7 @@ public abstract class BluetoothLeSensorPreference extends DialogPreference {
if (PreferencesUtils.getBluetoothFilterEnabled()) {
scanFilter = serviceUUIDs.stream()
.map(it -> new ScanFilter.Builder().setServiceUuid(it).build())
.collect(Collectors.toList());
.toList();
}
ScanSettings.Builder scanSettingsBuilder = new ScanSettings.Builder();