Package com.blazebit.persistence
Class PagedArrayList<T>
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList<E>
java.util.ArrayList<T>
com.blazebit.persistence.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
- Since:
- 1.2.0
- Author:
- Christian Beikov, Moritz Becker
- See Also:
-
Field Summary
Fields inherited from class java.util.AbstractList
modCount -
Constructor Summary
ConstructorsConstructorDescriptionPagedArrayList(KeysetPage keyset, long totalSize, int firstResult, int maxResults) Constructs a new empty paged array list.PagedArrayList(Collection<? extends T> collection, KeysetPage keyset, long totalSize, int firstResult, int maxResults) Constructs a new paged array list from the given collection. -
Method Summary
Modifier and TypeMethodDescriptionintReturns the position of the first result, numbered from 0.Returns the key set page for this paged list which can be used for key set pagination.intReturns the maximum number of results.intgetPage()Returns the number of this page, numbered from 1.intgetSize()Returns the actual size of this page.intReturns the number of total pages.longReturns the total size of the list or-1if the count query was disabled viaPaginatedCriteriaBuilder.withCountQuery(boolean).Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, equals, forEach, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeIf, removeRange, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSizeMethods inherited from class java.util.AbstractCollection
containsAll, toStringMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface java.util.List
add, add, addAll, addAll, clear, contains, containsAll, equals, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray
-
Constructor Details
-
PagedArrayList
Constructs a new empty paged array list.- Parameters:
keyset- The keyset page for this pagetotalSize- The total size of the resultfirstResult- The first result index within the overall resultmaxResults- 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 pagekeyset- The keyset page for this pagetotalSize- The total size of the resultfirstResult- The first result index within the overall resultmaxResults- The maximum result count for a page
-
-
Method Details
-
getSize
public int getSize()Description copied from interface:PagedListReturns the actual size of this page. -
getTotalSize
public long getTotalSize()Description copied from interface:PagedListReturns the total size of the list or-1if the count query was disabled viaPaginatedCriteriaBuilder.withCountQuery(boolean).- Specified by:
getTotalSizein interfacePagedList<T>- Returns:
- The total size or
-1if the count query was disabled
-
getPage
public int getPage()Description copied from interface:PagedListReturns the number of this page, numbered from 1. -
getTotalPages
public int getTotalPages()Description copied from interface:PagedListReturns the number of total pages.- Specified by:
getTotalPagesin interfacePagedList<T>- Returns:
- The number of total pages
-
getFirstResult
public int getFirstResult()Description copied from interface:PagedListReturns 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:
getFirstResultin interfacePagedList<T>- Returns:
- The position of the first result or
-1if the queried entity id does not exist
-
getMaxResults
public int getMaxResults()Description copied from interface:PagedListReturns the maximum number of results. This is the maximum number which was actually queried. This value might be different from KeysetPage.getFirstResult().- Specified by:
getMaxResultsin interfacePagedList<T>- Returns:
- The maximum number of results
-
getKeysetPage
Description copied from interface:PagedListReturns 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:
getKeysetPagein interfacePagedList<T>- Returns:
- The key set
- See Also:
-