Sorting on localName first is counter-intuitive and tends to spread
related names (from the same module/revision) across the domain. Sort by
module/revision first, which keeps related information closely together.
JIRA: YANGTOOLS-1298
Change-Id: Ia57418f915498a0713549195b86413988b5208ce
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
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<QName, ?>?
@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