- All Superinterfaces:
Finder.SortCriterion
- All Known Implementing Classes:
Finder.InMemorySortCriterion.DefaultInMemorySortCriterion
An interface that should be implemented by specific
Finder.SortCriterion objects which are capable to implement by themselves the sorting of objects, by
post-processing an existing collection of objects. While this is often convenient, it is possible for it to be inefficient in cases in which the original
source of objects is capable to perform the sort in an optimized way (e.g. an SQL database by means of ORDER BY). The facility class
HierarchicFinderSupport supports FilterSortCriterion objects out of the box.-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic class -
Field Summary
Fields inherited from interface it.tidalwave.util.Finder.SortCriterion
_SortCriterion_, DEFAULT, UNSORTED -
Method Summary
Modifier and TypeMethodDescriptionstatic <U> Finder.InMemorySortCriterion<U> of(Comparator<? super U> comparator) Creates a new in-memorySortCriterionbased on aComparator.static <U> Finder.InMemorySortCriterion<U> of(Comparator<? super U> comparator, String name) Creates a new in-memorySortCriterionbased on aComparator.default voidPerforms the sort of results.voidsort(List<? extends U> results, Finder.SortDirection sortDirection) Performs the sort of results.
-
Method Details
-
sort
Performs the sort of results.- Parameters:
results- the list of objects to be sorted in place
-
sort
Performs the sort of results.- Parameters:
results- the list of objects to be sorted in placesortDirection- the sort direction
-
of
Creates a new in-memorySortCriterionbased on aComparator.- Type Parameters:
U- the type of the objects to compare- Parameters:
comparator- theComparator- Returns:
- the new
SortCriterion
-
of
@Nonnull static <U> Finder.InMemorySortCriterion<U> of(@Nonnull Comparator<? super U> comparator, @Nonnull String name) Creates a new in-memorySortCriterionbased on aComparator.- Type Parameters:
U- the type of the objects to compare- Parameters:
comparator- theComparatorname- a name- Returns:
- the new
SortCriterion
-