diff --git a/main/commons/src/main/java/org/cryptomator/common/vaults/VaultListChangeListener.java b/main/commons/src/main/java/org/cryptomator/common/vaults/VaultListChangeListener.java index a7e422115..3fd6f4e23 100644 --- a/main/commons/src/main/java/org/cryptomator/common/vaults/VaultListChangeListener.java +++ b/main/commons/src/main/java/org/cryptomator/common/vaults/VaultListChangeListener.java @@ -22,10 +22,10 @@ class VaultListChangeListener implements ListChangeListener { public void onChanged(Change c) { while (c.next()) { if (c.wasAdded()) { - List addedSettings = c.getAddedSubList().stream().map(Vault::getVaultSettings).collect(Collectors.toList()); + List addedSettings = c.getAddedSubList().stream().map(Vault::getVaultSettings).toList(); vaultSettingsList.addAll(c.getFrom(), addedSettings); } else if (c.wasRemoved()) { - List removedSettings = c.getRemoved().stream().map(Vault::getVaultSettings).collect(Collectors.toList()); + List removedSettings = c.getRemoved().stream().map(Vault::getVaultSettings).toList(); vaultSettingsList.removeAll(removedSettings); } } diff --git a/main/commons/src/main/java/org/cryptomator/common/vaults/VaultListManager.java b/main/commons/src/main/java/org/cryptomator/common/vaults/VaultListManager.java index 984008ba9..b7c10a4d4 100644 --- a/main/commons/src/main/java/org/cryptomator/common/vaults/VaultListManager.java +++ b/main/commons/src/main/java/org/cryptomator/common/vaults/VaultListManager.java @@ -79,7 +79,7 @@ public class VaultListManager { } private void addAll(Collection vaultSettings) { - Collection vaults = vaultSettings.stream().map(this::create).collect(Collectors.toList()); + Collection vaults = vaultSettings.stream().map(this::create).toList(); vaultList.addAll(vaults); } diff --git a/main/commons/src/test/java/org/cryptomator/common/EnvironmentTest.java b/main/commons/src/test/java/org/cryptomator/common/EnvironmentTest.java index 11bfa4e2e..b68d4a631 100644 --- a/main/commons/src/test/java/org/cryptomator/common/EnvironmentTest.java +++ b/main/commons/src/test/java/org/cryptomator/common/EnvironmentTest.java @@ -32,7 +32,7 @@ class EnvironmentTest { public void testSettingsPath() { System.setProperty("cryptomator.settingsPath", "~/.config/Cryptomator/settings.json:~/.Cryptomator/settings.json"); - List result = env.getSettingsPath().collect(Collectors.toList()); + List result = env.getSettingsPath().toList(); MatcherAssert.assertThat(result, Matchers.hasSize(2)); MatcherAssert.assertThat(result, Matchers.contains(Paths.get("/home/testuser/.config/Cryptomator/settings.json"), // Paths.get("/home/testuser/.Cryptomator/settings.json"))); @@ -43,7 +43,7 @@ class EnvironmentTest { public void testIpcPortPath() { System.setProperty("cryptomator.ipcPortPath", "~/.config/Cryptomator/ipcPort.bin:~/.Cryptomator/ipcPort.bin"); - List result = env.getIpcPortPath().collect(Collectors.toList()); + List result = env.getIpcPortPath().toList(); MatcherAssert.assertThat(result, Matchers.hasSize(2)); MatcherAssert.assertThat(result, Matchers.contains(Paths.get("/home/testuser/.config/Cryptomator/ipcPort.bin"), // Paths.get("/home/testuser/.Cryptomator/ipcPort.bin"))); @@ -54,7 +54,7 @@ class EnvironmentTest { public void testKeychainPath() { System.setProperty("cryptomator.keychainPath", "~/AppData/Roaming/Cryptomator/keychain.json"); - List result = env.getKeychainPath().collect(Collectors.toList()); + List result = env.getKeychainPath().toList(); MatcherAssert.assertThat(result, Matchers.hasSize(1)); MatcherAssert.assertThat(result, Matchers.contains(Paths.get("/home/testuser/AppData/Roaming/Cryptomator/keychain.json"))); } @@ -88,7 +88,7 @@ class EnvironmentTest { @DisplayName("test.path.property=") public void testEmptyList() { System.setProperty("test.path.property", ""); - List result = env.getPaths("test.path.property").collect(Collectors.toList()); + List result = env.getPaths("test.path.property").toList(); MatcherAssert.assertThat(result, Matchers.hasSize(0)); } @@ -97,7 +97,7 @@ class EnvironmentTest { @DisplayName("test.path.property=/foo/bar/test") public void testSingleAbsolutePath() { System.setProperty("test.path.property", "/foo/bar/test"); - List result = env.getPaths("test.path.property").collect(Collectors.toList()); + List result = env.getPaths("test.path.property").toList(); MatcherAssert.assertThat(result, Matchers.hasSize(1)); MatcherAssert.assertThat(result, Matchers.hasItem(Paths.get("/foo/bar/test"))); @@ -107,7 +107,7 @@ class EnvironmentTest { @DisplayName("test.path.property=~/test") public void testSingleHomeRelativePath() { System.setProperty("test.path.property", "~/test"); - List result = env.getPaths("test.path.property").collect(Collectors.toList()); + List result = env.getPaths("test.path.property").toList(); MatcherAssert.assertThat(result, Matchers.hasSize(1)); MatcherAssert.assertThat(result, Matchers.hasItem(Paths.get("/home/testuser/test"))); @@ -117,7 +117,7 @@ class EnvironmentTest { @DisplayName("test.path.property=~/test:~/test2:/foo/bar/test") public void testMultiplePaths() { System.setProperty("test.path.property", "~/test:~/test2:/foo/bar/test"); - List result = env.getPaths("test.path.property").collect(Collectors.toList()); + List result = env.getPaths("test.path.property").toList(); MatcherAssert.assertThat(result, Matchers.hasSize(3)); MatcherAssert.assertThat(result, Matchers.contains(Paths.get("/home/testuser/test"), // diff --git a/main/launcher/src/main/java/org/cryptomator/launcher/FileOpenRequestHandler.java b/main/launcher/src/main/java/org/cryptomator/launcher/FileOpenRequestHandler.java index 8c9ac2f9f..9d1e3144d 100644 --- a/main/launcher/src/main/java/org/cryptomator/launcher/FileOpenRequestHandler.java +++ b/main/launcher/src/main/java/org/cryptomator/launcher/FileOpenRequestHandler.java @@ -41,7 +41,7 @@ class FileOpenRequestHandler { } private void openFiles(OpenFilesEvent evt) { - Collection pathsToOpen = evt.getFiles().stream().map(File::toPath).collect(Collectors.toList()); + Collection pathsToOpen = evt.getFiles().stream().map(File::toPath).toList(); AppLaunchEvent launchEvent = new AppLaunchEvent(AppLaunchEvent.EventType.OPEN_FILE, pathsToOpen); tryToEnqueueFileOpenRequest(launchEvent); } @@ -59,7 +59,7 @@ class FileOpenRequestHandler { LOG.trace("Argument not a valid path: {}", str); return null; } - }).filter(Objects::nonNull).collect(Collectors.toList()); + }).filter(Objects::nonNull).toList(); if (!pathsToOpen.isEmpty()) { AppLaunchEvent launchEvent = new AppLaunchEvent(AppLaunchEvent.EventType.OPEN_FILE, pathsToOpen); tryToEnqueueFileOpenRequest(launchEvent);