removed unnecessary stream support
Some checks failed
Build / Compile and Test (push) Has been cancelled

This commit is contained in:
Jan-Peter Klein 2024-10-10 17:39:53 +02:00
parent 764fccf0b5
commit 4b359d98cb
No known key found for this signature in database
GPG Key ID: 90EDA3A7C822FD0E

View File

@ -94,22 +94,19 @@ public final class GoogleDriveMacLocationPresetsProvider implements LocationPres
* <p>
* This method lists all directories within the provided {@code accountPath} and filters them
* to identify folders whose names match any of the translations defined in {@code MY_DRIVE_TRANSLATIONS}.
* <p>
* Each matching folder is then converted into a {@code LocationPreset} object.
*
* @param accountPath the root path of the Google Drive account to scan.
* @return a stream of {@code LocationPreset} objects representing matching directories.
*/
private Stream<LocationPreset> getPresetsFromAccountPath(Path accountPath) {
try (var driveStream = Files.list(accountPath)) {
List<Path> directories = StreamSupport.stream(driveStream.spliterator(), false).toList();
return directories.stream()
return driveStream
.filter(preset -> MY_DRIVE_TRANSLATIONS
.contains(preset.getFileName().toString()))
.map(drivePath -> new LocationPreset(
getDriveLocationString(accountPath),
drivePath
));
)).toList().stream();
} catch (IOException e) {
return Stream.empty();
}