Package it.tidalwave.util
Interface Finder.InMemorySortCriterion<U>
-
- All Superinterfaces:
Finder.SortCriterion
- All Known Implementing Classes:
Finder.InMemorySortCriterion.DefaultInMemorySortCriterion
public static interface Finder.InMemorySortCriterion<U> extends Finder.SortCriterion
An interface that should be implemented by specificFinder.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 ofORDER BY
). The facility classHierarchicFinderSupport
supportsFilterSortCriterion
objects out of the box.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
Finder.InMemorySortCriterion.DefaultInMemorySortCriterion<U>
-
Field Summary
-
Fields inherited from interface it.tidalwave.util.Finder.SortCriterion
_SortCriterion_, DEFAULT, UNSORTED
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description static <U> Finder.InMemorySortCriterion<U>
of(java.util.Comparator<? super U> comparator)
Creates a new in-memorySortCriterion
based on aComparator
.static <U> Finder.InMemorySortCriterion<U>
of(java.util.Comparator<? super U> comparator, java.lang.String name)
Creates a new in-memorySortCriterion
based on aComparator
.default void
sort(java.util.List<? extends U> results)
Performs the sort of results.void
sort(java.util.List<? extends U> results, Finder.SortDirection sortDirection)
Performs the sort of results.
-
-
-
Method Detail
-
sort
default void sort(@Nonnull java.util.List<? extends U> results)
Performs the sort of results.- Parameters:
results
- the list of objects to be sorted in place
-
sort
void sort(@Nonnull java.util.List<? extends U> results, @Nonnull Finder.SortDirection sortDirection)
Performs the sort of results.- Parameters:
results
- the list of objects to be sorted in placesortDirection
- the sort direction
-
of
@Nonnull static <U> Finder.InMemorySortCriterion<U> of(@Nonnull java.util.Comparator<? super U> comparator)
Creates a new in-memorySortCriterion
based 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 java.util.Comparator<? super U> comparator, @Nonnull java.lang.String name)
Creates a new in-memorySortCriterion
based on aComparator
.- Type Parameters:
U
- the type of the objects to compare- Parameters:
comparator
- theComparator
name
- a name- Returns:
- the new
SortCriterion
-
-