boon/src/main/java/org/boon/sort/Sort.java
public <T> Collection<T> sort( Class<T> componentClass, Collection<T> collection ) {

        if (collection instanceof List) {
            sort((List) collection);
            return collection;
        }

        if ( collection == null || collection.size() == 0 ) {
            return Collections.EMPTY_LIST;
        }


        Map<String, FieldAccess> fields = BeanUtils.getFieldsFromObject( componentClass );
        T[] array = toArray(componentClass, collection);
        Arrays.sort( array, this.comparator( fields ) );

        if (collection instanceof Set){
            return new LinkedHashSet<>( Lists.list(array));
        } else {
            return Lists.list(array);
        }
    }
public <T> Collection<T> sort( Class<T> componentClass, Collection<T> collection ) {

        if (collection instanceof List) {
            sort((List) collection);
            return collection;
        }

        if ( collection == null || collection.size() == 0 ) {
            return Collections.EMPTY_LIST;
        }


        Map<String, FieldAccess> fields = BeanUtils.getFieldsFromObject( componentClass );
        T[] array = toArray(componentClass, collection);
        Arrays.sort( array, this.comparator( fields ) );

        if (collection instanceof Set){
            return new LinkedHashSet<>( Lists.list(array));
        } else {
            return Lists.list(array);
        }
    }
public < T > Collection < T > sort ( Class < T > componentClass , Collection < T > collection ) { if ( collection instanceof List ) { sort ( ( List ) collection ) ; return collection ; } if ( collection == null || collection . size ( ) == 0 ) { return Collections . EMPTY_LIST ; } Map < String , FieldAccess > fields = BeanUtils . getFieldsFromObject ( componentClass ) ; T [ ] array = toArray ( componentClass , collection ) ; Arrays . sort ( array , this . comparator ( fields ) ) ; if ( collection instanceof Set ) { return new LinkedHashSet <> ( Lists . list ( array ) ) ; } else { return Lists . list ( array ) ; } }
Sort and you look up the reflection fields.
@param collection the collection to sort
Sort and you look up the reflection fields .