Class PagedArrayList<T>

Type Parameters:
T - the type of elements in this list
All Implemented Interfaces:
PagedList<T>, Serializable, Cloneable, Iterable<T>, Collection<T>, List<T>, RandomAccess

public class PagedArrayList<T> extends ArrayList<T> implements PagedList<T>
A simple implementation of PagedList based on ArrayList.
Since:
1.2.0
Author:
Christian Beikov, Moritz Becker
See Also:
  • Constructor Details

    • PagedArrayList

      public PagedArrayList(KeysetPage keyset, long totalSize, int firstResult, int maxResults)
      Constructs a new empty paged array list.
      Parameters:
      keyset - The keyset page for this page
      totalSize - The total size of the result
      firstResult - The first result index within the overall result
      maxResults - The maximum result count for a page
    • PagedArrayList

      public PagedArrayList(Collection<? extends T> collection, KeysetPage keyset, long totalSize, int firstResult, int maxResults)
      Constructs a new paged array list from the given collection.
      Parameters:
      collection - The collection of elements for this page
      keyset - The keyset page for this page
      totalSize - The total size of the result
      firstResult - The first result index within the overall result
      maxResults - The maximum result count for a page
  • Method Details

    • getSize

      public int getSize()
      Description copied from interface: PagedList
      Returns the actual size of this page.
      Specified by:
      getSize in interface PagedList<T>
      Returns:
      The actual size
      See Also:
    • getTotalSize

      public long getTotalSize()
      Description copied from interface: PagedList
      Returns the total size of the list or -1 if the count query was disabled via PaginatedCriteriaBuilder.withCountQuery(boolean).
      Specified by:
      getTotalSize in interface PagedList<T>
      Returns:
      The total size or -1 if the count query was disabled
    • getPage

      public int getPage()
      Description copied from interface: PagedList
      Returns the number of this page, numbered from 1.
      Specified by:
      getPage in interface PagedList<T>
      Returns:
      The number of this page
    • getTotalPages

      public int getTotalPages()
      Description copied from interface: PagedList
      Returns the number of total pages.
      Specified by:
      getTotalPages in interface PagedList<T>
      Returns:
      The number of total pages
    • getFirstResult

      public int getFirstResult()
      Description copied from interface: PagedList
      Returns the position of the first result, numbered from 0. This is the position which was actually queried. This value might be different from KeysetPage.getFirstResult(). If this list was queried with an entity id which does not exist, this will return -1;
      Specified by:
      getFirstResult in interface PagedList<T>
      Returns:
      The position of the first result or -1 if the queried entity id does not exist
    • getMaxResults

      public int getMaxResults()
      Description copied from interface: PagedList
      Returns the maximum number of results. This is the maximum number which was actually queried. This value might be different from KeysetPage.getFirstResult().
      Specified by:
      getMaxResults in interface PagedList<T>
      Returns:
      The maximum number of results
    • getKeysetPage

      public KeysetPage getKeysetPage()
      Description copied from interface: PagedList
      Returns the key set page for this paged list which can be used for key set pagination. The key set page may be null if key set pagination wasn't used.
      Specified by:
      getKeysetPage in interface PagedList<T>
      Returns:
      The key set
      See Also: