Package net.swofty.utility
Class PaginationList<T>
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList<E>
java.util.ArrayList<T>
net.swofty.utility.PaginationList<T>
- Type Parameters:
- T- Type of the ArrayList
- All Implemented Interfaces:
- Serializable,- Cloneable,- Iterable<T>,- Collection<T>,- List<T>,- RandomAccess
A page-based ArrayList
 * Pages are NOT index-based (they start at 1, not 0)
 * A page sublist is created when you call a method to get one; it is not created and then updated accordingly.
- See Also:
- 
Field SummaryFields inherited from class java.util.AbstractListmodCount
- 
Constructor SummaryConstructorsConstructorDescriptionPaginationList(int elementsPerPage) Defines a new Pagination List.PaginationList(int elementsPerPage, T... elements) Defines a new Pagination List.PaginationList(Collection<T> collection, int elementsPerPage) 
- 
Method SummaryModifier and TypeMethodDescriptionintgetPage(int page) Get a page from the list.intgetPages()voidsetElementsPerPage(int elementsPerPage) Sets the element count per page.toString()Methods inherited from class java.util.ArrayListadd, 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.AbstractCollectioncontainsAllMethods inherited from class java.lang.Objectfinalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.CollectionparallelStream, stream, toArrayMethods inherited from interface java.util.ListcontainsAll
- 
Constructor Details- 
PaginationList
- 
PaginationListpublic PaginationList(int elementsPerPage) Defines a new Pagination List.- Parameters:
- elementsPerPage- How many elements will be included on a page of the list.
 
- 
PaginationListDefines a new Pagination List.- Parameters:
- elementsPerPage- How many elements will be included on a page of the list.
- elements- Elements to add to the list immediately.
 
 
- 
- 
Method Details- 
getElementsPerPagepublic int getElementsPerPage()- Returns:
- The amount of elements per page.
 
- 
setElementsPerPagepublic void setElementsPerPage(int elementsPerPage) Sets the element count per page.- Parameters:
- elementsPerPage- Updated element count per page
 
- 
getPageCountpublic int getPageCount()- Returns:
- The number of pages this list holds.
 
- 
getPageGet a page from the list.- Parameters:
- page- Page you want to access.
- Returns:
- A sublist of only the elements from that page.
 
- 
getPages- Returns:
- A 2D List with every page.
 
- 
addAll
- 
toString- Overrides:
- toStringin class- AbstractCollection<T>
 
 
-