From: Robert Varga Date: Mon, 8 Sep 2014 17:20:56 +0000 (+0200) Subject: BUG-650: ResolveDataChangeState.inheritedOne should be a Collection X-Git-Tag: release/helium~122^2 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=commitdiff_plain;h=2c05037792ab14927d35ec913acd82c7c4fc0234 BUG-650: ResolveDataChangeState.inheritedOne should be a Collection There is no need to demote this to Iterable just to then use Iterables.isEmpty(), as we are always initializing it with a collection, which has a quick isEmpty() method. Also promote its order before interitedSub, so the slow path can be faster a bit. Change-Id: Ic536e2420cfae98941ec638510c98ec3a8230c09 Signed-off-by: Robert Varga --- diff --git a/opendaylight/md-sal/sal-inmemory-datastore/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/ResolveDataChangeState.java b/opendaylight/md-sal/sal-inmemory-datastore/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/ResolveDataChangeState.java index ea95030de3..828e4e30a1 100644 --- a/opendaylight/md-sal/sal-inmemory-datastore/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/ResolveDataChangeState.java +++ b/opendaylight/md-sal/sal-inmemory-datastore/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/ResolveDataChangeState.java @@ -47,7 +47,7 @@ final class ResolveDataChangeState { /** * Inherited from immediate parent */ - private final Iterable inheritedOne; + private final Collection inheritedOne; private final YangInstanceIdentifier nodeId; private final Collection nodes; @@ -56,7 +56,7 @@ final class ResolveDataChangeState { private final Map, Builder> baseBuilders = new HashMap<>(); private ResolveDataChangeState(final YangInstanceIdentifier nodeId, - final Iterable inheritedSub, final Iterable inheritedOne, + final Iterable inheritedSub, final Collection inheritedOne, final Collection nodes) { this.nodeId = Preconditions.checkNotNull(nodeId); this.nodes = Preconditions.checkNotNull(nodes); @@ -138,12 +138,12 @@ final class ResolveDataChangeState { if (!nodes.isEmpty()) { return true; } - // Have SUBTREE listeners - if (!Iterables.isEmpty(inheritedSub)) { + // Have ONE listeners + if (!inheritedOne.isEmpty()) { return true; } - // Have ONE listeners - if (!Iterables.isEmpty(inheritedOne)) { + // Have SUBTREE listeners + if (!Iterables.isEmpty(inheritedSub)) { return true; }