/** {@inheritDoc} */ public int compareTo(Annotation other) { int result = type.compareTo(other.type); if (result != 0) { return result; } result = visibility.compareTo(other.visibility); if (result != 0) { return result; } Iterator<NameValuePair> thisIter = elements.values().iterator(); Iterator<NameValuePair> otherIter = other.elements.values().iterator(); while (thisIter.hasNext() && otherIter.hasNext()) { NameValuePair thisOne = thisIter.next(); NameValuePair otherOne = otherIter.next(); result = thisOne.compareTo(otherOne); if (result != 0) { return result; } } if (thisIter.hasNext()) { return 1; } else if (otherIter.hasNext()) { return -1; } return 0; }