This is a short-circuit version of the varargs create(), which is
slighly faster.
Change-Id: Id6b6ae327cd8e5d63108c766532dd8ab91188637
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit
224b2fe77f786ac4c524ee2ec4d581b3914af92b)
private final ImmutableList<PathArgument> path;
private transient volatile YangInstanceIdentifier parent;
- private FixedYangInstanceIdentifier(final ImmutableList<PathArgument> path, final int hash) {
+ FixedYangInstanceIdentifier(final ImmutableList<PathArgument> path, final int hash) {
super(hash);
this.path = requireNonNull(path, "path must not be null.");
}
return FixedYangInstanceIdentifier.create(path, hash.build());
}
+ @Beta
+ public static @NonNull YangInstanceIdentifier create(final PathArgument pathArgument) {
+ return new FixedYangInstanceIdentifier(ImmutableList.of(pathArgument),
+ HashCodeBuilder.nextHashCode(1, pathArgument));
+ }
+
public static @NonNull YangInstanceIdentifier create(final PathArgument... path) {
// We are forcing a copy, since we cannot trust the user
return create(Arrays.asList(path));