contains instead of stream

This commit is contained in:
Jan-Peter Klein 2024-10-09 14:48:40 +02:00
parent fd55656261
commit 98db82d137
No known key found for this signature in database
GPG Key ID: 90EDA3A7C822FD0E

View File

@ -106,7 +106,13 @@ public final class GoogleDriveMacLocationPresetsProvider implements LocationPres
private Stream<LocationPreset> getPresetsFromAccountPath(Path accountPath) {
try (var driveStream = Files.list(accountPath)) {
List<Path> directories = StreamSupport.stream(driveStream.spliterator(), false).toList();
return directories.stream().filter(preset -> MY_DRIVE_TRANSLATIONS.stream().anyMatch(translation -> preset.getFileName().toString().equalsIgnoreCase(translation))).map(drivePath -> new LocationPreset(getDriveLocationString(accountPath, drivePath), drivePath));
return directories.stream()
.filter(preset -> MY_DRIVE_TRANSLATIONS
.contains(preset.getFileName().toString()))
.map(drivePath -> new LocationPreset(
getDriveLocationString(accountPath, drivePath),
drivePath
));
} catch (IOException e) {
return Stream.empty();
}