Using ImmutableList.of() is slightly faster, use that.
Change-Id: Ia45d18dc840e8985a1037e7235c01da5f873d870
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
+import com.google.common.collect.ImmutableSet;
import java.util.Collections;
import java.util.Optional;
import org.junit.Test;
final AugmentationNode mockedAugmentationNode = mock(AugmentationNode.class);
final QName listQName = QName.create("test-ns", "2016-09-16", "list-node");
- final AugmentationIdentifier augNodeId = new AugmentationIdentifier(Collections.singleton(listQName));
+ final AugmentationIdentifier augNodeId = new AugmentationIdentifier(ImmutableSet.of(listQName));
doReturn(augNodeId).when(mockedAugmentationNode).getIdentifier();
final MapNode mockedMapNode = mock(MapNode.class);
import static org.opendaylight.yangtools.yang.data.impl.schema.Builders.containerBuilder;
import static org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes.leafNode;
+import com.google.common.collect.ImmutableSet;
import com.google.gson.stream.JsonReader;
import java.io.IOException;
import java.io.StringReader;
import java.net.URISyntaxException;
-import java.util.Collections;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
final QName containerQName = QName.create(augmentChoice1QName, "case11-choice-case-container");
final QName leafQName = QName.create(augmentChoice1QName, "case11-choice-case-leaf");
- final AugmentationIdentifier aug1Id = new AugmentationIdentifier(Collections.singleton(augmentChoice1QName));
- final AugmentationIdentifier aug2Id = new AugmentationIdentifier(Collections.singleton(augmentChoice2QName));
+ final AugmentationIdentifier aug1Id = new AugmentationIdentifier(ImmutableSet.of(augmentChoice1QName));
+ final AugmentationIdentifier aug2Id = new AugmentationIdentifier(ImmutableSet.of(augmentChoice2QName));
final NodeIdentifier augmentChoice1Id = new NodeIdentifier(augmentChoice1QName);
final NodeIdentifier augmentChoice2Id = new NodeIdentifier(augmentChoice2QName);
final NodeIdentifier containerId = new NodeIdentifier(containerQName);
import com.google.common.collect.ImmutableSet;
import java.util.Arrays;
-import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import org.opendaylight.yangtools.yang.common.QName;
private static DataContainerChild<? extends PathArgument, ?> augmentC11AWithLf15_21Node() {
return Builders.augmentationBuilder().withNodeIdentifier(
- new AugmentationIdentifier(Collections.singleton(QName.create("ns:complex:json", "2014-08-11", "lf15_21"))))
+ new AugmentationIdentifier(ImmutableSet.of(QName.create("ns:complex:json", "2014-08-11", "lf15_21"))))
.withChild(lf15_21Node()).build();
}
import static java.util.Objects.requireNonNull;
+import com.google.common.collect.ImmutableSet;
import java.io.IOException;
import java.io.InputStream;
import java.io.StringWriter;
import java.net.URI;
import java.util.Collection;
-import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import javax.xml.stream.XMLOutputFactory;
.build();
AugmentationNode myDoublyKeyedListAugNode = Builders.augmentationBuilder().withNodeIdentifier(
- new AugmentationIdentifier(Collections.singleton(myDoublyKeyedList)))
+ new AugmentationIdentifier(ImmutableSet.of(myDoublyKeyedList)))
.withChild(myDoublyKeyedListNode).build();
ContainerNode myContainer3Node = Builders.containerBuilder().withNodeIdentifier(
.withChild(myDoublyKeyedListAugNode).build();
AugmentationNode myContainer3AugNode = Builders.augmentationBuilder().withNodeIdentifier(
- new AugmentationIdentifier(Collections.singleton(myContainer3)))
+ new AugmentationIdentifier(ImmutableSet.of(myContainer3)))
.withChild(myContainer3Node).build();
ContainerNode outerContainerNode = Builders.containerBuilder().withNodeIdentifier(
import static java.util.Objects.requireNonNull;
+import com.google.common.collect.ImmutableSet;
import java.io.IOException;
import java.io.InputStream;
import java.io.StringWriter;
import java.net.URI;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
.build();
AugmentationNode myDoublyKeyedListAugNode = Builders.augmentationBuilder().withNodeIdentifier(
- new AugmentationIdentifier(Collections.singleton(myDoublyKeyedList)))
+ new AugmentationIdentifier(ImmutableSet.of(myDoublyKeyedList)))
.withChild(myDoublyKeyedListNode).build();
ContainerNode myContainer3Node = Builders.containerBuilder().withNodeIdentifier(
.withChild(myDoublyKeyedListAugNode).build();
AugmentationNode myContainer3AugNode = Builders.augmentationBuilder().withNodeIdentifier(
- new AugmentationIdentifier(Collections.singleton(myContainer3)))
+ new AugmentationIdentifier(ImmutableSet.of(myContainer3)))
.withChild(myContainer3Node).build();
ContainerNode outerContainerNode = Builders.containerBuilder().withNodeIdentifier(
import static org.junit.Assert.fail;
import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableSet;
import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
import java.net.URISyntaxException;
-import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import javax.xml.parsers.ParserConfigurationException;
.build();
AugmentationNode myDoublyKeyedListAugNode = Builders.augmentationBuilder().withNodeIdentifier(
- new AugmentationIdentifier(Collections.singleton(MY_DOUBLY_KEYED_LIST)))
+ new AugmentationIdentifier(ImmutableSet.of(MY_DOUBLY_KEYED_LIST)))
.withChild(myDoublyKeyedListNode).build();
ContainerNode myContainer3Node = Builders.containerBuilder().withNodeIdentifier(
.withChild(myDoublyKeyedListAugNode).build();
AugmentationNode myContainer3AugNode = Builders.augmentationBuilder().withNodeIdentifier(
- new AugmentationIdentifier(Collections.singleton(MY_CONTAINER_3)))
+ new AugmentationIdentifier(ImmutableSet.of(MY_CONTAINER_3)))
.withChild(myContainer3Node).build();
ContainerNode outerContainerNode = Builders.containerBuilder().withNodeIdentifier(
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
+import com.google.common.collect.ImmutableSet;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.text.ParseException;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
.build();
AugmentationNode myDoublyKeyedListAugNode = Builders.augmentationBuilder().withNodeIdentifier(
- new AugmentationIdentifier(Collections.singleton(myDoublyKeyedList)))
+ new AugmentationIdentifier(ImmutableSet.of(myDoublyKeyedList)))
.withChild(myDoublyKeyedListNode).build();
ContainerNode myContainer3Node = Builders.containerBuilder().withNodeIdentifier(
.withChild(myDoublyKeyedListAugNode).build();
AugmentationNode myContainer3AugNode = Builders.augmentationBuilder().withNodeIdentifier(
- new AugmentationIdentifier(Collections.singleton(myContainer3)))
+ new AugmentationIdentifier(ImmutableSet.of(myContainer3)))
.withChild(myContainer3Node).build();
ContainerNode outerContainerNode = Builders.containerBuilder().withNodeIdentifier(
import static org.junit.Assert.assertEquals;
-import java.util.Collections;
+import com.google.common.collect.ImmutableSet;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
private final NodeIdentifier outerContainer = new NodeIdentifier(QName.create(NS, REVISION, "outer-container"));
private final NodeIdentifier augmentedLeaf = new NodeIdentifier(QName.create(NS, REVISION, "augmented-leaf"));
private final AugmentationIdentifier augmentation = new AugmentationIdentifier(
- Collections.singleton(augmentedLeaf.getNodeType()));
+ ImmutableSet.of(augmentedLeaf.getNodeType()));
- private final NodeIdentifier outerList = new NodeIdentifier(
- QName.create(NS, REVISION, "outer-list"));
+ private final NodeIdentifier outerList = new NodeIdentifier(QName.create(NS, REVISION, "outer-list"));
private final NodeIdentifierWithPredicates outerListWithKey = NodeIdentifierWithPredicates.of(
QName.create(NS, REVISION, "outer-list"), ID, 1);
private final NodeIdentifier choice = new NodeIdentifier(QName.create(NS, REVISION, "outer-choice"));
private final NodeIdentifier leafFromCase = new NodeIdentifier(QName.create(NS, REVISION, "one"));
private final NodeIdentifier leafList = new NodeIdentifier(QName.create(NS, REVISION, "ordered-leaf-list"));
- private final NodeWithValue<?> leafListWithValue = new NodeWithValue<>(
- leafList.getNodeType(), "abcd");
+ private final NodeWithValue<?> leafListWithValue = new NodeWithValue<>(leafList.getNodeType(), "abcd");
@BeforeClass
public static void setUp() {
import static com.google.common.base.Preconditions.checkState;
+import com.google.common.collect.ImmutableSet;
import java.io.File;
import java.net.URI;
import java.net.URISyntaxException;
AugmentationNode augmentation = Builders
.augmentationBuilder()
.withNodeIdentifier(
- new AugmentationIdentifier(Collections.singleton(getQName("augmentUint32"))))
+ new AugmentationIdentifier(ImmutableSet.of(getQName("augmentUint32"))))
.withChild(
Builders.<Integer>leafBuilder().withNodeIdentifier(getNodeIdentifier("augmentUint32"))
.withValue(11).build()).build();