Do not use entrySet() where values() or keySet() suffices
[mdsal.git] / dom / mdsal-dom-inmemory-datastore / src / main / java / org / opendaylight / mdsal / dom / store / inmemory / WriteableNodeWithSubshard.java
1 /*
2  * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8
9 package org.opendaylight.mdsal.dom.store.inmemory;
10
11 import com.google.common.collect.ImmutableMap;
12 import java.util.Map;
13 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
14
15 abstract class WriteableNodeWithSubshard extends WriteableModificationNode {
16
17     private final Map<PathArgument, WriteableModificationNode> children;
18
19     WriteableNodeWithSubshard(final Map<PathArgument, WriteableModificationNode> children) {
20         this.children = ImmutableMap.copyOf(children);
21     }
22
23     @Override
24     Map<PathArgument, WriteableModificationNode> getChildrenWithSubshards() {
25         return children;
26     }
27
28     @Override
29     WriteableModificationNode getChild(final PathArgument node) {
30         return children.get(node);
31     }
32
33     @Override
34     void markDeleted() {
35         for (WriteableModificationNode child : children.values()) {
36             child.markDeleted();
37         }
38     }
39 }