Merge if statements 57/107557/1
authorRobert Varga <robert.varga@pantheon.tech>
Tue, 29 Aug 2023 17:59:57 +0000 (19:59 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Tue, 29 Aug 2023 17:59:57 +0000 (19:59 +0200)
if() with an instanceof pattern can be merged with the if() using that
pattern's assigned variable.

Change-Id: I531231c04b180abd4096716f982efa7a6011c70c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
common/util/src/main/java/org/opendaylight/yangtools/util/ClassLoaderUtils.java

index 8681af68ed706af0c44359f77fecd0a2f4462436..db136459a6aa6288156a50d63465b77076750f2c 100644 (file)
@@ -140,10 +140,8 @@ public final class ClassLoaderUtils {
         requireNonNull(genericType);
 
         for (var type : subclass.getGenericInterfaces()) {
-            if (type instanceof ParameterizedType ptype) {
-                if (genericType.equals(ptype.getRawType())) {
-                    return Optional.of(ptype);
-                }
+            if (type instanceof ParameterizedType ptype && genericType.equals(ptype.getRawType())) {
+                return Optional.of(ptype);
             }
         }