*/
package org.opendaylight.yangtools.yang.data.api.schema;
+import com.google.common.annotations.Beta;
import java.util.Collection;
+import java.util.Map;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
/**
- * Containment node, which contains {@link MapEntryNode} of the same type, which may
- * be quickly retrieved using key.
+ * Containment node, which contains {@link MapEntryNode} of the same type, which may be quickly retrieved using a key.
*
* <p>
- * This node maps to the list node in YANG schema, schema and semantics of this node,
- * its children and key construction is defined by YANG <code>list</code>
- * statement and its <code>key</code> and <code>ordered-by</code> substatements.
+ * This node maps to the list node in YANG schema, schema and semantics of this node, its children and key construction
+ * is defined by YANG {@code list} statement and its {@code key} and {@code ordered-by} substatements.
*/
-public interface MapNode extends MixinNode, DataContainerChild<NodeIdentifier, Collection<MapEntryNode>>,
- NormalizedNodeContainer<NodeIdentifier, NodeIdentifierWithPredicates, MapEntryNode> {
+public interface MapNode
+ extends DistinctNodeContainer<NodeIdentifierWithPredicates, MapEntryNode>, DataContainerChild, MixinNode {
+ @Override
+ Class<? extends MapNode> contract();
+ @Override
+ NodeIdentifier getIdentifier();
+
+ /**
+ * Return a {@link Map} view of this node. Note that the iteration order of the returned is map is not defined in
+ * this interface.
+ *
+ * @return Map view of this node.
+ */
+ @Beta
+ @NonNull Map<NodeIdentifierWithPredicates, MapEntryNode> asMap();
+
+ @Override
+ default Collection<@NonNull MapEntryNode> body() {
+ return asMap().values();
+ }
+
+ @Override
+ default int size() {
+ return asMap().size();
+ }
+
+ @Override
+ default boolean isEmpty() {
+ return asMap().isEmpty();
+ }
}