소스 검색

As per feedback on PR #690: refactored if-statement.

jellemdekker 6 년 전
부모
커밋
a58259d4f0
1개의 변경된 파일4개의 추가작업 그리고 4개의 파일을 삭제
  1. 4 4
      main/ui/src/main/java/org/cryptomator/ui/controllers/MainController.java

+ 4 - 4
main/ui/src/main/java/org/cryptomator/ui/controllers/MainController.java

@@ -224,13 +224,13 @@ public class MainController implements ViewController {
 					forceShutdownButtonType, forceShutdownButtonType, tryAgainButtonType);
 
 			Optional<ButtonType> 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);
 				}
-			}
+			});
 		}
 	}