private int compareDegrees(final OutboundMobilityCandidacyContest o) {
   return executionDegreesCompareHash(
           o.getOutboundMobilityCandidacyContestGroup().getExecutionDegreeSet())
       .compareTo(
           executionDegreesCompareHash(
               getOutboundMobilityCandidacyContestGroup().getExecutionDegreeSet()));
 }
 private int compareCountries(final OutboundMobilityCandidacyContest o) {
   final Country c1 = getMobilityAgreement().getUniversityUnit().getCountry();
   final Country c2 = o.getMobilityAgreement().getUniversityUnit().getCountry();
   return c1 == c2
       ? 0
       : (c1 != null && c2 != null ? c1.getName().compareTo(c2.getName()) : (c1 == null ? -1 : 1));
 }
 private int comparePrograms(final OutboundMobilityCandidacyContest o) {
   return getMobilityAgreement()
       .getMobilityProgram()
       .getRegistrationProtocol()
       .getDescription()
       .compareTo(
           o.getMobilityAgreement()
               .getMobilityProgram()
               .getRegistrationProtocol()
               .getDescription());
 }
 @Override
 public int compareTo(final OutboundMobilityCandidacyContest o) {
   final int edc = compareDegrees(o);
   if (edc == 0) {
     final int cc = compareCountries(o);
     if (cc == 0) {
       final int uc = compareUniversities(o);
       if (uc == 0) {
         final int pc = comparePrograms(o);
         return pc == 0 ? getExternalId().compareTo(o.getExternalId()) : pc;
       }
       return uc;
     }
     return cc;
   }
   return edc;
 }
 private int compareUniversities(final OutboundMobilityCandidacyContest o) {
   return Unit.COMPARATOR_BY_NAME_AND_ID.compare(
       getMobilityAgreement().getUniversityUnit(), o.getMobilityAgreement().getUniversityUnit());
 }