mirror of
https://github.com/cryptomator/cryptomator.git
synced 2026-04-23 19:16:57 -04:00
Fixed random set order and updated #getAvailableDriveLetter()
Fixed bug introduced by 32a810fe1d:
The Set of existing DriveLetters was in random order because Collectors#toUnmodifiableSet is an unordered collector.
Changed #getAvailableDriveLetter() to use Stream#findFirst() instead of #findAny()
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
*******************************************************************************/
|
||||
package org.cryptomator.common.vaults;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Sets;
|
||||
import org.apache.commons.lang3.SystemUtils;
|
||||
|
||||
@@ -25,7 +26,7 @@ public final class WindowsDriveLetters {
|
||||
|
||||
static {
|
||||
try (IntStream stream = IntStream.rangeClosed('C', 'Z')) {
|
||||
C_TO_Z = stream.mapToObj(i -> String.valueOf((char) i)).collect(Collectors.toUnmodifiableSet());
|
||||
C_TO_Z = stream.mapToObj(i -> String.valueOf((char) i)).collect(ImmutableSet.toImmutableSet());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,7 +52,7 @@ public final class WindowsDriveLetters {
|
||||
}
|
||||
|
||||
public Optional<String> getAvailableDriveLetter() {
|
||||
return getAvailableDriveLetters().stream().findAny();
|
||||
return getAvailableDriveLetters().stream().findFirst();
|
||||
}
|
||||
|
||||
public Optional<Path> getAvailableDriveLetterPath() {
|
||||
|
||||
Reference in New Issue
Block a user