public List < T > execute ( ) { if ( CollectionUtils . isEmpty ( from ) ) { logger . info ( "Querying from an empty collection, returning empty list." ) ; return Collections . emptyList ( ) ; } List copied = new ArrayList ( this . from ) ; logger . info ( "Start apply predicate [{}] to collection with [{}] items." , predicate , copied . size ( ) ) ; CollectionUtils . filter ( copied , this . predicate ) ; logger . info ( "Done filtering collection, filtered result size is [{}]" , copied . size ( ) ) ; if ( null != this . comparator && copied . size ( ) > 1 ) { Comparator actualComparator = this . descSorting ? comparator . desc ( ) : comparator . asc ( ) ; logger . info ( "Start to sort the filtered collection with comparator [{}]" , actualComparator ) ; Collections . sort ( copied , actualComparator ) ; logger . info ( "Done sorting the filtered collection." ) ; } logger . info ( "Start to slect from filtered collection with selector [{}]." , selector ) ; List < T > select = this . selector . select ( copied ) ; logger . info ( "Done select from filtered collection." ) ; return select ; }
Execute this Query . If query from a null or empty collection an empty list will be returned .