Simplify ActionSpec.equals(Object) 79/102579/1
authorRobert Varga <robert.varga@pantheon.tech>
Thu, 6 Oct 2022 12:20:55 +0000 (14:20 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Thu, 6 Oct 2022 16:36:07 +0000 (18:36 +0200)
We can use an instanceof pattern, squashing logic accordingly.

Change-Id: Ice925cc99d90b1c918ce17cfdc987275db932381
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
binding/mdsal-binding-api/src/main/java/org/opendaylight/mdsal/binding/api/ActionSpec.java

index 554fa5f4a8bebc070cfe1236ef7a455f237c1633..0c8e9d2a55d9ff72cffaaac7d3a10d306b3b2010 100644 (file)
@@ -72,14 +72,8 @@ public final class ActionSpec<A extends Action<? extends InstanceIdentifier<P>,
 
     @Override
     public boolean equals(final Object obj) {
-        if (obj == this) {
-            return true;
-        }
-        if (!(obj instanceof ActionSpec)) {
-            return false;
-        }
-        final var other = (ActionSpec<?, ?>) obj;
-        return type.equals(other.type) && path.equals(other.path);
+        return obj == this || obj instanceof ActionSpec<?, ?> other
+            && type.equals(other.type) && path.equals(other.path);
     }
 
     @Override