import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
-import org.opendaylight.yangtools.concepts.Immutable;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yangtools.util.MapAdaptor;
import org.opendaylight.yangtools.util.UnmodifiableCollection;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
this.value = MapAdaptor.getDefaultInstance().takeSnapshot(node.children);
}
- public static CollectionNodeBuilder<MapEntryNode, MapNode> create() {
+ public static @NonNull CollectionNodeBuilder<MapEntryNode, MapNode> create() {
return new ImmutableMapNodeBuilder();
}
- public static CollectionNodeBuilder<MapEntryNode, MapNode> create(final int sizeHint) {
+ public static @NonNull CollectionNodeBuilder<MapEntryNode, MapNode> create(final int sizeHint) {
return new ImmutableMapNodeBuilder(sizeHint);
}
}
@Override
- public CollectionNodeBuilder<MapEntryNode, MapNode> withValue(final Collection<MapEntryNode> value) {
+ public CollectionNodeBuilder<MapEntryNode, MapNode> withValue(final Collection<MapEntryNode> withValue) {
// TODO replace or putAll ?
- for (final MapEntryNode mapEntryNode : value) {
+ for (final MapEntryNode mapEntryNode : withValue) {
withChild(mapEntryNode);
}
}
@Override
- public CollectionNodeBuilder<MapEntryNode, MapNode> withNodeIdentifier(final NodeIdentifier nodeIdentifier) {
- this.nodeIdentifier = nodeIdentifier;
+ public CollectionNodeBuilder<MapEntryNode, MapNode> withNodeIdentifier(final NodeIdentifier withNodeIdentifier) {
+ this.nodeIdentifier = withNodeIdentifier;
return this;
}
return withChild(child);
}
-
@Override
public NormalizedNodeContainerBuilder<NodeIdentifier, PathArgument, MapEntryNode, MapNode> removeChild(
final PathArgument key) {
}
protected static final class ImmutableMapNode
- extends AbstractImmutableNormalizedNode<NodeIdentifier, Collection<MapEntryNode>>
- implements Immutable, MapNode {
+ extends AbstractImmutableNormalizedNode<NodeIdentifier, Collection<MapEntryNode>> implements MapNode {
private final Map<NodeIdentifierWithPredicates, MapEntryNode> children;
return UnmodifiableCollection.create(children.values());
}
+ @Override
+ public int size() {
+ return children.size();
+ }
+
@Override
protected int valueHashCode() {
return children.hashCode();