using pattern-matching instanceof where applicable

This commit is contained in:
Sebastian Stenzel
2021-03-17 09:22:16 +01:00
parent f73ae9759f
commit 4e075ab0ca
6 changed files with 10 additions and 12 deletions
@@ -42,8 +42,8 @@ public class DefaultSceneFactory implements Function<Parent, Scene> {
protected void configureScene(Scene scene) {
scene.windowProperty().addListener(observable -> {
Window window = scene.getWindow();
if (window instanceof Stage) {
setupDefaultAccelerators(scene, (Stage) window);
if (window instanceof Stage s) {
setupDefaultAccelerators(scene, s);
}
});
}
@@ -76,8 +76,8 @@ public class UnlockWorkflow extends Task<Boolean> {
setOnFailed(event -> {
Throwable throwable = event.getSource().getException();
if (throwable instanceof InvalidMountPointException) {
handleInvalidMountPoint((InvalidMountPointException) throwable);
if (throwable instanceof InvalidMountPointException e) {
handleInvalidMountPoint(e);
} else {
handleGenericError(throwable);
}