Exemple #1
0
 @Override
 public int compare(final Country country1, Country country2) {
   final String name1 = country1.getName().getContent();
   final String name2 = country2.getName().getContent();
   final int c = Collator.getInstance().compare(name1, name2);
   if (c == 0) {
     final String acronym1 = country1.getAcronym();
     final String acronym2 = country2.getAcronym();
     if (acronym1 == null || acronym2 == null) {
       return country2.hashCode() - country1.hashCode();
     }
     final int a = Collator.getInstance().compare(acronym1, acronym2);
     return a == 0 ? country2.hashCode() - country1.hashCode() : a;
   }
   return c;
 }
Exemple #2
0
 public static Country findByAcronym(String acronym) {
   for (Country country : Bennu.getInstance().getCountriesSet()) {
     if (country.getAcronym().equalsIgnoreCase(acronym)) {
       return country;
     }
   }
   return null;
 }