Modernize yang-data-impl
[yangtools.git] / data / yang-data-impl / src / main / java / org / opendaylight / yangtools / yang / data / impl / schema / builder / impl / ImmutableUserLeafSetNodeBuilder.java
index 5f64b8709f1d7618ba8825826d52b3fe03a02477..c206e9fa039685a1b222c8c34d4b07c8340ea5c0 100644 (file)
@@ -45,7 +45,7 @@ public class ImmutableUserLeafSetNodeBuilder<T> implements ListNodeBuilder<T, Us
     public static <T> @NonNull ListNodeBuilder<T, UserLeafSetNode<T>> create(
             final UserLeafSetNode<T> node) {
         if (!(node instanceof ImmutableUserLeafSetNode<?>)) {
-            throw new UnsupportedOperationException(String.format("Cannot initialize from class %s", node.getClass()));
+            throw new UnsupportedOperationException("Cannot initialize from class " + node.getClass());
         }
 
         return new ImmutableUserLeafSetNodeBuilder<>((ImmutableUserLeafSetNode<T>) node);
@@ -143,8 +143,8 @@ public class ImmutableUserLeafSetNodeBuilder<T> implements ListNodeBuilder<T, Us
 
         @Override
         protected boolean valueEquals(final UserLeafSetNode<?> other) {
-            if (other instanceof ImmutableUserLeafSetNode) {
-                return children.equals(((ImmutableUserLeafSetNode<?>) other).children);
+            if (other instanceof ImmutableUserLeafSetNode<?> immutableOther) {
+                return children.equals(immutableOther.children);
             }
             // Note: performs a size() check first
             return Iterables.elementsEqual(children.values(), other.body());