diff --git a/src/main/java/de/bwravencl/controllerbuddy/input/KeyStroke.java b/src/main/java/de/bwravencl/controllerbuddy/input/KeyStroke.java index 3b5cccef..507663e6 100644 --- a/src/main/java/de/bwravencl/controllerbuddy/input/KeyStroke.java +++ b/src/main/java/de/bwravencl/controllerbuddy/input/KeyStroke.java @@ -62,14 +62,9 @@ public Object clone() throws CloneNotSupportedException { @Override public boolean equals(final Object obj) { - if (this == obj) { - return true; - } - if (obj == null || getClass() != obj.getClass()) { - return false; - } - final var other = (KeyStroke) obj; - return Arrays.equals(keyCodes, other.keyCodes) && Arrays.equals(modifierCodes, other.modifierCodes); + return obj instanceof final KeyStroke keyStroke + && Arrays.equals(keyCodes, keyStroke.keyCodes) + && Arrays.equals(modifierCodes, keyStroke.modifierCodes); } public ScanCode[] getKeyCodes() { diff --git a/src/main/java/de/bwravencl/controllerbuddy/input/Mode.java b/src/main/java/de/bwravencl/controllerbuddy/input/Mode.java index 17271b9a..829d4a8d 100644 --- a/src/main/java/de/bwravencl/controllerbuddy/input/Mode.java +++ b/src/main/java/de/bwravencl/controllerbuddy/input/Mode.java @@ -75,15 +75,7 @@ public Object clone() throws CloneNotSupportedException { @Override public boolean equals(final Object obj) { - if (this == obj) { - return true; - } - if (obj == null || getClass() != obj.getClass()) { - return false; - } - final var other = (Mode) obj; - - return Objects.equals(uuid, other.uuid); + return obj instanceof final Mode mode && Objects.equals(uuid, mode.uuid); } public Set> getAllActions() {