Collections.sort(infoQualifications, new Comparator() {  public int compare(Object o1, Object o2) { InfoQualification infoQualification1 = (InfoQualification) o1; InfoQualification infoQualification2 = (InfoQualification) o2; if (infoQualification1.getYear() == null && infoQualification2.getYear() == null) { return 0; } else if (infoQualification1.getYear() == null) { return -1; } else if (infoQualification2.getYear() == null) { return 1; } else { String[] strings1 = infoQualification1.getYear().split("/"); String[] strings2 = infoQualification2.getYear().split("/");  if (Integer.valueOf(getYear(strings1)) < Integer.valueOf(getYear(strings2))) { return -1; } else if (Integer.valueOf(getYear(strings1)) > Integer.valueOf(getYear(strings2))) { return 1; } else if (infoQualification1.getYear().equals(infoQualification2.getYear())) { return 0; } } return 0; }  private String getYear(String[] strings1) { String year1 = null; if(strings1.length == 1){ year1 = strings1[0]; } else if(strings1.length == 2){ year1 = strings1[1]; } return year1; } });
    private List getInfoQualifications(ISuportePersistente sp, ITeacher teacher)            throws ExcepcaoPersistencia {        List<IQualification> qualifications = teacher.getPerson().getAssociatedQualifications();        List infoQualifications = (List) CollectionUtils.collect(qualifications, new Transformer() {            public Object transform(Object o) {                IQualification qualification = (IQualification) o;                return InfoQualification.newInfoFromDomain(qualification);            }        });                        Collections.sort(infoQualifications, new BeanComparator("year"));                return infoQualifications;    }