From 6cf18c33a1e2b70c46d759a4df8e81081470a03c Mon Sep 17 00:00:00 2001 From: Sebastian Stenzel Date: Wed, 11 Mar 2026 21:12:47 +0100 Subject: [PATCH] simplify sorting --- .../hub/CheckHostAuthenticityController.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/cryptomator/ui/keyloading/hub/CheckHostAuthenticityController.java b/src/main/java/org/cryptomator/ui/keyloading/hub/CheckHostAuthenticityController.java index 3adcdda85..2a7435849 100644 --- a/src/main/java/org/cryptomator/ui/keyloading/hub/CheckHostAuthenticityController.java +++ b/src/main/java/org/cryptomator/ui/keyloading/hub/CheckHostAuthenticityController.java @@ -21,9 +21,10 @@ import javafx.scene.text.TextFlow; import javafx.stage.Stage; import java.net.URI; import java.util.Arrays; -import java.util.HashSet; import java.util.ResourceBundle; import java.util.Set; +import java.util.SortedSet; +import java.util.TreeSet; import java.util.concurrent.CompletableFuture; import java.util.stream.Collectors; @@ -41,7 +42,7 @@ public class CheckHostAuthenticityController implements FxController { private final CompletableFuture result; private final Settings settings; private final ResourceBundle resourceBundle; - private final Set hostnames; + private final SortedSet hostnames; @FXML private Label messageLabel; @@ -58,7 +59,7 @@ public class CheckHostAuthenticityController implements FxController { this.result = result; this.settings = settings; this.resourceBundle = resourceBundle; - this.hostnames = new HashSet<>(); + this.hostnames = new TreeSet<>(); } @FXML @@ -94,7 +95,9 @@ public class CheckHostAuthenticityController implements FxController { private void renderHostnames() { hostnamesFlow.getChildren().clear(); - hostnames.stream().sorted().forEach(hostname -> hostnamesFlow.getChildren().add(new Text(hostname + System.lineSeparator()))); + for (var hostname : hostnames) { + hostnamesFlow.getChildren().add(new Text(hostname + System.lineSeparator())); + } var messageKey = hostnames.size() > 1 ? MESSAGE_PLURAL_KEY : MESSAGE_SINGULAR_KEY; messageLabel.setText(resourceBundle.getString(messageKey)); }