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.Collections;
12 import java.util.List;
13 import org.opendaylight.yangtools.concepts.Identifiable;
14 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
17 * Entry describing a duplicate found in a {@link NormalizedNode} tree. Note this
18 * class leaks mutable collections, so users are advised either not to share it.
20 public final class DuplicateEntry implements Identifiable<YangInstanceIdentifier> {
21 private final List<YangInstanceIdentifier> hardLinks = new ArrayList<>(1);
22 private List<YangInstanceIdentifier> duplicates = Collections.emptyList();
24 DuplicateEntry(final YangInstanceIdentifier path) {
28 void addDuplicate(final YangInstanceIdentifier path) {
29 if (duplicates.isEmpty()) {
30 duplicates = new ArrayList<>();
35 void addHardLink(final YangInstanceIdentifier path) {
40 public YangInstanceIdentifier getIdentifier() {
41 return hardLinks.get(0);
44 public List<YangInstanceIdentifier> getHardLinks() {
48 public List<YangInstanceIdentifier> getDuplicates() {