Class PaginationUtils

java.lang.Object
org.craftercms.studio.impl.v2.utils.PaginationUtils

public class PaginationUtils extends Object
Utility class with methods for pagination.
Author:
avasquez
  • Method Details

    • paginate

      public static <T> List<T> paginate(List<T> list, int offset, int limit, String sortBy)
      Performs pagination on the list, returning from the specified offset to the specified limit. The list can also be sorted by the sortBy (optional).
      Parameters:
      list - the list to paginate
      offset - the offset from where to start
      limit - the max number of elements that the paginated list should include
      sortBy - the property used for sorting
      Returns:
      the paginated list