X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=common%2Fyang-common%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fyangtools%2Fyang%2Fcommon%2FQName.java;h=60072a1b5955967a49c2106e38eea812802ca7e1;hb=75b733f25eded9e015812c4a49af1f11296be8c3;hp=2c19fa9f0295263ad9a6f85f7eed1a7c7ce47e80;hpb=240a52123138150dbf63c759748f0ca7a68be74d;p=yangtools.git diff --git a/common/yang-common/src/main/java/org/opendaylight/yangtools/yang/common/QName.java b/common/yang-common/src/main/java/org/opendaylight/yangtools/yang/common/QName.java index 2c19fa9f02..60072a1b59 100644 --- a/common/yang-common/src/main/java/org/opendaylight/yangtools/yang/common/QName.java +++ b/common/yang-common/src/main/java/org/opendaylight/yangtools/yang/common/QName.java @@ -371,17 +371,11 @@ public final class QName extends AbstractQName implements Comparable { return getLocalName().equals(other.getLocalName()) && Objects.equals(getNamespace(), other.getNamespace()); } - // FIXME: this comparison function looks odd. We are sorting first by local name and then by module? What is - // the impact on iteration order of SortedMap? @Override @SuppressWarnings("checkstyle:parameterName") public int compareTo(final QName o) { - // compare mandatory localName parameter - int result = getLocalName().compareTo(o.getLocalName()); - if (result != 0) { - return result; - } - return module.compareTo(o.module); + final int result = module.compareTo(o.module); + return result != 0 ? result : getLocalName().compareTo(o.getLocalName()); } @Override