forked from upstream-mirrors/OpenTracks
Cleanup: SelectionData is a record.
This commit is contained in:
@@ -216,7 +216,7 @@ public class ContentProviderUtils {
|
||||
public List<Track> getTracks(ContentProviderSelectionInterface selection) {
|
||||
SelectionData selectionData = selection.buildSelection();
|
||||
ArrayList<Track> tracks = new ArrayList<>();
|
||||
try (Cursor cursor = getTrackCursor(selectionData.getSelection(), selectionData.getSelectionArgs(), TracksColumns._ID)) {
|
||||
try (Cursor cursor = getTrackCursor(selectionData.selection(), selectionData.selectionArgs(), TracksColumns._ID)) {
|
||||
if (cursor != null && cursor.moveToFirst()) {
|
||||
tracks.ensureCapacity(cursor.getCount());
|
||||
do {
|
||||
|
||||
@@ -1,24 +1,11 @@
|
||||
package de.dennisguse.opentracks.data;
|
||||
|
||||
public class SelectionData {
|
||||
private final String selection;
|
||||
private final String[] selectionArgs;
|
||||
public record SelectionData(
|
||||
String selection,
|
||||
String[] selectionArgs
|
||||
) {
|
||||
|
||||
public SelectionData() {
|
||||
selection = null;
|
||||
selectionArgs = null;
|
||||
}
|
||||
|
||||
public SelectionData(String selection, String[] selectionArgs) {
|
||||
this.selection = selection;
|
||||
this.selectionArgs = selectionArgs;
|
||||
}
|
||||
|
||||
public String getSelection() {
|
||||
return selection;
|
||||
}
|
||||
|
||||
public String[] getSelectionArgs() {
|
||||
return selectionArgs;
|
||||
this(null, null);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user