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

        if (collection instanceof List) {
            sort ((List) collection, sortBy, ascending, nullsFirst);
            return collection;
        } else {
            V[] array = toArray(componentType, collection);
            sort(array, sortBy, ascending, nullsFirst);
            if (collection instanceof LinkedHashSet) {
                return new LinkedHashSet<>(Lists.list(array));
            } else {
                return Lists.list(array);
            }
        }
    }
public static <V> Collection<V>  sort( Class<V> componentType, Collection<V> collection, String sortBy, boolean ascending, boolean nullsFirst ) {

        if (collection instanceof List) {
            sort ((List) collection, sortBy, ascending, nullsFirst);
            return collection;
        } else {
            V[] array = toArray(componentType, collection);
            sort(array, sortBy, ascending, nullsFirst);
            if (collection instanceof LinkedHashSet) {
                return new LinkedHashSet<>(Lists.list(array));
            } else {
                return Lists.list(array);
            }
        }
    }
public static < V > Collection < V > sort ( Class < V > componentType , Collection < V > collection , String sortBy , boolean ascending , boolean nullsFirst ) { if ( collection instanceof List ) { sort ( ( List ) collection , sortBy , ascending , nullsFirst ) ; return collection ; } else { V [ ] array = toArray ( componentType , collection ) ; sort ( array , sortBy , ascending , nullsFirst ) ; if ( collection instanceof LinkedHashSet ) { return new LinkedHashSet <> ( Lists . list ( array ) ) ; } else { return Lists . list ( array ) ; } } }
Sort collection.
@param collection the collection 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 .