code: public static <T> Collection<T> sortByCriteria(Collection<T> aVOs)
     {
  
        final List<T> list;
  
        if (aVOs instanceof List)
           list = (List<T>) aVOs;
        else
           list = new ArrayList<T>(aVOs);
  
        Collections.sort(list, new CriteriaComparator());
  
        return list;
  
     }
docs: Sort a list
  @param <T> the type
  @param aVOs the value objects
  @return collection the sorted criteria