Interface Finder.InMemorySortCriterion<U>

  • All Superinterfaces:
    Finder.SortCriterion
    All Known Implementing Classes:
    Finder.InMemorySortCriterion.DefaultInMemorySortCriterion
    Enclosing interface:
    Finder<T>

    public static interface Finder.InMemorySortCriterion<U>
    extends Finder.SortCriterion
    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.
    • 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 place
        sortDirection - the sort direction
      • of

        @Nonnull
        static <U> Finder.InMemorySortCriterion<U> of​(@Nonnull
                                                      java.util.Comparator<? super U> comparator)
        Creates a new in-memory SortCriterion based on a Comparator.
        Type Parameters:
        U - the type of the objects to compare
        Parameters:
        comparator - the Comparator
        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-memory SortCriterion based on a Comparator.
        Type Parameters:
        U - the type of the objects to compare
        Parameters:
        comparator - the Comparator
        name - a name
        Returns:
        the new SortCriterion