From a58259d4f05a4363666f80663388af60f018af7d Mon Sep 17 00:00:00 2001 From: jellemdekker Date: Tue, 21 Aug 2018 15:27:32 +0200 Subject: [PATCH] As per feedback on PR #690: refactored if-statement. --- .../org/cryptomator/ui/controllers/MainController.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/main/ui/src/main/java/org/cryptomator/ui/controllers/MainController.java b/main/ui/src/main/java/org/cryptomator/ui/controllers/MainController.java index 2df9a1926..76f069388 100644 --- a/main/ui/src/main/java/org/cryptomator/ui/controllers/MainController.java +++ b/main/ui/src/main/java/org/cryptomator/ui/controllers/MainController.java @@ -224,13 +224,13 @@ public class MainController implements ViewController { forceShutdownButtonType, forceShutdownButtonType, tryAgainButtonType); Optional choice = gracefulShutdownDialog.showAndWait(); - if (choice.isPresent()) { - if (tryAgainButtonType.equals(choice.get())) { + choice.ifPresent(btnType -> { + if (tryAgainButtonType.equals(btnType)) { gracefulShutdown(); - } else if (forceShutdownButtonType.equals(choice.get())) { + } else if (forceShutdownButtonType.equals(btnType)) { Platform.runLater(Platform::exit); } - } + }); } }