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
ConstructorDescriptionPagedArrayList
(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 TypeMethodDescriptionint
Returns 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.int
Returns the maximum number of results.int
getPage()
Returns the number of this page, numbered from 1.int
getSize()
Returns the actual size of this page.int
Returns the number of total pages.long
Returns the total size of the list or-1
if 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, trimToSize
Methods inherited from class java.util.AbstractCollection
containsAll, toString
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
Methods 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:PagedList
Returns the actual size of this page. -
getTotalSize
public long getTotalSize()Description copied from interface:PagedList
Returns the total size of the list or-1
if the count query was disabled viaPaginatedCriteriaBuilder.withCountQuery(boolean)
.- Specified by:
getTotalSize
in interfacePagedList<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. -
getTotalPages
public int getTotalPages()Description copied from interface:PagedList
Returns the number of total pages.- Specified by:
getTotalPages
in interfacePagedList<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 interfacePagedList<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 interfacePagedList<T>
- Returns:
- The maximum number of results
-
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 interfacePagedList<T>
- Returns:
- The key set
- See Also:
-