Use YangInstanceIdentifier.isEmpty() 62/22762/2
authorRobert Varga <rovarga@cisco.com>
Tue, 16 Jun 2015 19:52:14 +0000 (21:52 +0200)
committerGerrit Code Review <gerrit@opendaylight.org>
Wed, 1 Jul 2015 14:39:34 +0000 (14:39 +0000)
Do not force instatiation of path arguments, emptiness can be checked
quickly using isEmpty() method.

Change-Id: I52f70309c5eb839a9532e499e681562fc4b95587
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit d620bc2f6bdb883d1f91a42c93a4ce109725b287)

opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/util/NetconfBaseOps.java

index bf432d3..65e4658 100644 (file)
@@ -29,7 +29,6 @@ import static org.opendaylight.controller.sal.connect.netconf.util.NetconfMessag
 
 import com.google.common.base.Optional;
 import com.google.common.base.Preconditions;
-import com.google.common.collect.Iterables;
 import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
@@ -193,7 +192,7 @@ public final class NetconfBaseOps {
     }
 
     private boolean isFilterPresent(final Optional<YangInstanceIdentifier> filterPath) {
-        return filterPath.isPresent() && Iterables.isEmpty(filterPath.get().getPathArguments()) == false;
+        return filterPath.isPresent() && !filterPath.get().isEmpty();
     }
 
     public ListenableFuture<DOMRpcResult> editConfigCandidate(final FutureCallback<? super DOMRpcResult> callback, final DataContainerChild<?, ?> editStructure, final ModifyAction modifyAction, final boolean rollback) {

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.