2 * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
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
8 package org.opendaylight.yangtools.yang.data.api.schema;
10 import java.util.ArrayList;
11 import java.util.List;
12 import org.opendaylight.yangtools.concepts.Identifiable;
13 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
16 * Entry describing a duplicate found in a {@link NormalizedNode} tree. Note this
17 * class leaks mutable collections, so users are advised either not to share it.
19 public final class DuplicateEntry implements Identifiable<YangInstanceIdentifier> {
20 private final List<YangInstanceIdentifier> hardLinks = new ArrayList<>(1);
21 private List<YangInstanceIdentifier> duplicates = List.of();
23 DuplicateEntry(final YangInstanceIdentifier path) {
27 void addDuplicate(final YangInstanceIdentifier path) {
28 if (duplicates.isEmpty()) {
29 duplicates = new ArrayList<>();
34 void addHardLink(final YangInstanceIdentifier path) {
39 public YangInstanceIdentifier getIdentifier() {
40 return hardLinks.get(0);
43 public List<YangInstanceIdentifier> getHardLinks() {
47 public List<YangInstanceIdentifier> getDuplicates() {