Package it.tidalwave.util
Interface Finder.InMemorySortCriterion<TYPE>
-
- All Superinterfaces:
Finder.SortCriterion
- All Known Implementing Classes:
Finder.InMemorySortCriterion.DefaultInMemorySortCriterion
public static interface Finder.InMemorySortCriterion<TYPE> 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 classFinderSupport
supportsFilterSortCriterion
objects out of the box.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
Finder.InMemorySortCriterion.DefaultInMemorySortCriterion<T>
-
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 <T> Finder.InMemorySortCriterion<T>
of(java.util.Comparator<? super T> comparator)
Creates a new in-memorySortCriterion
based on aComparator
.static <T> Finder.InMemorySortCriterion<T>
of(java.util.Comparator<? super T> comparator, java.lang.String name)
Creates a new in-memorySortCriterion
based on aComparator
.default void
sort(java.util.List<? extends TYPE> results)
Performs the sort of results.void
sort(java.util.List<? extends TYPE> results, Finder.SortDirection sortDirection)
Performs the sort of results.
-
-
-
Method Detail
-
sort
default void sort(@Nonnull java.util.List<? extends TYPE> 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 TYPE> 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 <T> Finder.InMemorySortCriterion<T> of(@Nonnull java.util.Comparator<? super T> comparator)
Creates a new in-memorySortCriterion
based on aComparator
.- Type Parameters:
T
- the type of the objects to compare- Parameters:
comparator
- theComparator
- Returns:
- the new
SortCriterion
-
of
@Nonnull static <T> Finder.InMemorySortCriterion<T> of(@Nonnull java.util.Comparator<? super T> comparator, @Nonnull java.lang.String name)
Creates a new in-memorySortCriterion
based on aComparator
.- Type Parameters:
T
- the type of the objects to compare- Parameters:
comparator
- theComparator
name
- a name- Returns:
- the new
SortCriterion
-
-