Class PaginatedList<T>
java.lang.Object
java.util.AbstractCollection<T>
java.util.AbstractList<T>
java.util.ArrayList<T>
api.equinix.javasdk.core.http.response.PaginatedList<T>
- Type Parameters:
T- the type of resource in the list
- All Implemented Interfaces:
Serializable,Cloneable,Iterable<T>,Collection<T>,List<T>,RandomAccess,SequencedCollection<T>
A paginated list of resources returned by Equinix API list operations.
Extends ArrayList with pagination metadata and automatic page loading.
All SDK list operations return this type (or PaginatedFilteredList for search operations).
Provides methods to check for additional pages, load the next page, or eagerly load all pages.
Usage
PaginatedList<Port> ports = fabric.ports().list();
// Access pagination metadata
Pagination pagination = ports.getPagination();
int total = pagination.getTotal();
boolean isLast = pagination.getIsLastPage();
// Load additional pages
while (ports.hasNextPage()) {
ports.next();
}
// Or load all pages at once
ports.loadAll();
- Version:
- $Id: $Id
- Author:
- ianjones
- See Also:
-
Field Summary
Fields inherited from class java.util.AbstractList
modCount -
Constructor Summary
ConstructorsConstructorDescriptionPaginatedList(PaginatedList<T> initialItems, Pageable<T> pageableClient, EquinixRequest<T> equinixRequest, EquinixResponse<T> equinixResponse, Pagination pagination) Constructor for PaginatedList. -
Method Summary
Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, addFirst, addLast, clear, clone, contains, ensureCapacity, equals, forEach, get, getFirst, getLast, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeFirst, removeIf, removeLast, 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, stream, toArrayMethods inherited from interface java.util.List
containsAll, reversed
-
Constructor Details
-
PaginatedList
public PaginatedList(PaginatedList<T> initialItems, Pageable<T> pageableClient, EquinixRequest<T> equinixRequest, EquinixResponse<T> equinixResponse, Pagination pagination) Constructor for PaginatedList.
- Parameters:
initialItems- aPaginatedListobject.pageableClient- aPageableobject.equinixRequest- aEquinixRequestobject.equinixResponse- aEquinixResponseobject.pagination- aPaginationobject.
-
-
Method Details
-
hasNextPage
public boolean hasNextPage()Returnstrueif there are more pages of results available from the API.- Returns:
trueif a next page exists;falseif this is the last page
-
next
public void next()Loads the next page of results from the API and appends them to this list. Does nothing if there are no more pages. After calling this method, the pagination metadata is updated to reflect the newly loaded page. -
loadAll
Eagerly loads all remaining pages from the API, appending all results to this list. After calling this method, the list contains all available resources andhasNextPage()will returnfalse.- Returns:
- this list, now containing all resources across all pages
-