Class Pagination

java.lang.Object
dev.tachyonmcp.core.server.features.Pagination

@InternalApi public final class Pagination extends Object
Static pagination utility shared by registries.
  • Field Details

    • DEFAULT_PAGE_SIZE

      public static final int DEFAULT_PAGE_SIZE
      Default page size used when a request omits (or non-positively sizes) its limit.
      See Also:
  • Method Details

    • paginate

      public static <T> PaginatedResult<T> paginate(List<T> sorted, int limit, @Nullable String cursor, Function<T,String> key)
      Paginates a sorted list. Items must be sorted in ascending order by the key function.
      Parameters:
      sorted - the sorted list of items
      limit - requested page size (≤0 floors to 1)
      cursor - opaque cursor (last item name from previous page, or null for first page)
      key - extracts the cursor key from each item