Make variadic enter() a default method 23/49423/2
authorRobert Varga <rovarga@cisco.com>
Thu, 15 Dec 2016 11:21:12 +0000 (12:21 +0100)
committerRobert Varga <rovarga@cisco.com>
Thu, 15 Dec 2016 11:23:17 +0000 (12:23 +0100)
Implementations do not need to implement this themselves,
as it can be implemented efficiently by wrapping the argument
in Arrays.asList().

Change-Id: I07d282dbd23555642d52bc3d6a81158526c3a03e
Signed-off-by: Robert Varga <rovarga@cisco.com>
dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMDataTreeCursor.java

index 7f758c34604bef1ba53e50d6a1d41443ebfb6dc0..99632a5111706e813b13cf970eb26440dc4ee060 100644 (file)
@@ -8,6 +8,7 @@
 package org.opendaylight.mdsal.dom.api;
 
 import com.google.common.annotations.Beta;
+import java.util.Arrays;
 import javax.annotation.Nonnull;
 import javax.annotation.concurrent.NotThreadSafe;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
@@ -38,7 +39,9 @@ public interface DOMDataTreeCursor extends AutoCloseable {
      * @throws IllegalArgumentException when specified path does not identify a valid child, or if
      *         that child is not an instance of {@link NormalizedNodeContainer}.
      */
-    void enter(@Nonnull PathArgument... path);
+    default void enter(@Nonnull final PathArgument... path) {
+        enter(Arrays.asList(path));
+    }
 
     /**
      * Move the cursor to the specified child of the current position. This is equivalent to