Interface Finder.InMemorySortCriterion<TYPE>

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

    public static interface Finder.InMemorySortCriterion<TYPE>
    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 FinderSupport supports FilterSortCriterion objects out of the box.
    • 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 place
        sortDirection - the sort direction
      • of

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