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 <rovarga@cisco.com>
/**
* Inherited from immediate parent
*/
/**
* Inherited from immediate parent
*/
- private final Iterable<Builder> inheritedOne;
+ private final Collection<Builder> inheritedOne;
private final YangInstanceIdentifier nodeId;
private final Collection<Node> nodes;
private final YangInstanceIdentifier nodeId;
private final Collection<Node> nodes;
private final Map<DataChangeListenerRegistration<?>, Builder> baseBuilders = new HashMap<>();
private ResolveDataChangeState(final YangInstanceIdentifier nodeId,
private final Map<DataChangeListenerRegistration<?>, Builder> baseBuilders = new HashMap<>();
private ResolveDataChangeState(final YangInstanceIdentifier nodeId,
- final Iterable<Builder> inheritedSub, final Iterable<Builder> inheritedOne,
+ final Iterable<Builder> inheritedSub, final Collection<Builder> inheritedOne,
final Collection<Node> nodes) {
this.nodeId = Preconditions.checkNotNull(nodeId);
this.nodes = Preconditions.checkNotNull(nodes);
final Collection<Node> nodes) {
this.nodeId = Preconditions.checkNotNull(nodeId);
this.nodes = Preconditions.checkNotNull(nodes);
if (!nodes.isEmpty()) {
return true;
}
if (!nodes.isEmpty()) {
return true;
}
- // Have SUBTREE listeners
- if (!Iterables.isEmpty(inheritedSub)) {
+ // Have ONE listeners
+ if (!inheritedOne.isEmpty()) {
- // Have ONE listeners
- if (!Iterables.isEmpty(inheritedOne)) {
+ // Have SUBTREE listeners
+ if (!Iterables.isEmpty(inheritedSub)) {