boon/src/main/java/org/boon/sort/Sorting.java
public static <V> Iterable<V> sort( Class<V> componentType, Iterable<V> iterable, String sortBy, boolean ascending, boolean nullsFirst ) {

        if (iterable instanceof List) {
            sort ((List) iterable, sortBy, ascending, nullsFirst);
            return iterable;
        } else if (iterable instanceof  Collection) {
            return sort (componentType, (Collection<V>) iterable, sortBy, ascending, nullsFirst);
        } else {
            List<V> list = Lists.list(iterable);
            sort ( list, sortBy, ascending, nullsFirst);
            return list;
        }
    }
public static <V> Iterable<V> sort( Class<V> componentType, Iterable<V> iterable, String sortBy, boolean ascending, boolean nullsFirst ) {

        if (iterable instanceof List) {
            sort ((List) iterable, sortBy, ascending, nullsFirst);
            return iterable;
        } else if (iterable instanceof  Collection) {
            return sort (componentType, (Collection<V>) iterable, sortBy, ascending, nullsFirst);
        } else {
            List<V> list = Lists.list(iterable);
            sort ( list, sortBy, ascending, nullsFirst);
            return list;
        }
    }
public static < V > Iterable < V > sort ( Class < V > componentType , Iterable < V > iterable , String sortBy , boolean ascending , boolean nullsFirst ) { if ( iterable instanceof List ) { sort ( ( List ) iterable , sortBy , ascending , nullsFirst ) ; return iterable ; } else if ( iterable instanceof Collection ) { return sort ( componentType , ( Collection < V > ) iterable , sortBy , ascending , nullsFirst ) ; } else { List < V > list = Lists . list ( iterable ) ; sort ( list , sortBy , ascending , nullsFirst ) ; return list ; } }
Sort collection.
@param iterable the iterable you want to sort
@param sortBy what you want to sort the list by
@param ascending do you want ascending order
@param nullsFirst do you want nulls first
Sort collection .