public interface PaginatedList<T> extends Iterable<T>
load()
to load the first page of the list and loadNext()
for subsequent pages.
To directly load a page other than the first or to specify the page size, use
the overloaded forms load(int)
and load(int, int)
.Modifier and Type | Method and Description |
---|---|
boolean |
contains(T element)
Returns true if the given element has been loaded in this list.
|
T |
get(int index)
Returns the element at the given index.
|
int |
getFirstLoadedIndex()
Returns the index of the first item loaded in this list, or -1
if the list is empty or hasn't been loaded.
|
int |
getFirstLoadedPage()
Returns the index of the first page loaded in this list, or -1
if the list hasn't been loaded.
|
int |
getLastLoadedIndex()
Returns the index of the last item loaded in this list, or -1 if
the list is empty or hasn't been loaded.
|
int |
getLastLoadedPage()
Returns the index of the last page loaded in this list, or -1 if
the list hasn't been loaded.
|
int |
getPageSize()
Returns the page size used by this list.
|
boolean |
hasNextPage()
Returns true if there may be more pages of data available after
the last loaded page.
|
int |
indexOf(T element)
Returns the index of the given element in this list.
|
boolean |
isEmpty()
Returns true if this list contains no elements.
|
boolean |
isLoaded()
Returns true if this list has been loaded, i.e.
|
PaginatedList<T> |
load()
Loads the first page of data from BellaDati.
|
PaginatedList<T> |
load(int size)
Loads the first page of data from BellaDati, using the given page size.
|
PaginatedList<T> |
load(int page,
int size)
Loads the given page of data from BellaDati, using the given page size.
|
PaginatedList<T> |
loadNext()
Loads the next page of data from BellaDati, using the page size from the
most recent call to
load() , load(int) or
load(int, int) . |
int |
size()
Returns the size of the list as currently loaded.
|
List<T> |
toList()
Returns the currently loaded contents of this list as an immutable
List . |
PaginatedList<T> load()
PaginatedList<T> load(int size) throws IllegalArgumentException
size
- size to use in paginationIllegalArgumentException
- if size <= 0PaginatedList<T> load(int page, int size) throws IllegalArgumentException
page
- index of the requested pagesize
- size to use in paginationIllegalArgumentException
- if page < 0 || size <= 0PaginatedList<T> loadNext()
load()
, load(int)
or
load(int, int)
.
If no load method has been called on this list yet, calling this method
is equivalent to calling load()
without parameters.boolean isLoaded()
boolean hasNextPage()
getPageSize()
elementsint getFirstLoadedPage()
int getLastLoadedPage()
hasNextPage()
to find out if
more pages are available, and loadNext()
to load more pages.int getFirstLoadedIndex()
int getLastLoadedIndex()
int getPageSize()
boolean contains(T element)
element
- the element to look forT get(int index) throws IndexOutOfBoundsException
index
- of the element to returnIndexOutOfBoundsException
- if the given index hasn't been loaded,
or the index is out of rangeint indexOf(T element)
element
- element to search forboolean isEmpty()
int size()
getLastLoadedIndex()
- getFirstLoadedIndex()
+ 1.Copyright © 2014. All rights reserved.