Class ListResponse<T>
java.lang.Object
com.sinch.sdk.core.models.pagination.ListResponse<T>
- Type Parameters:
T
- Page content items type
- Direct Known Subclasses:
ActiveNumberListResponse
,AvailableNumberListResponse
,AvailableRegionListResponse
,BatchesListResponse
,ContactListResponse
,ConversationsListRecentResponse
,ConversationsListResponse
,DeliveryReportsListResponse
,EventsListResponse
,GroupsListResponse
,InboundsListResponse
,MessagesListResponse
Abstract class used for handling unified paginated response
Act as an iterator over pages response and pages content.
- Since:
- 1.0
-
Method Summary
Modifier and TypeMethodDescriptionabstract Collection
<T> Get the page items collection contentabstract boolean
Indicate if another page response is availableiterator()
Get an iterator across all items available across all page responsesabstract ListResponse
<T> nextPage()
Get next page response if availablestream()
Getting a stream across all items
-
Method Details
-
hasNextPage
public abstract boolean hasNextPage()Indicate if another page response is available- Returns:
- Returns true if the iteration has more pages. (In other words, returns true if next() would return a page rather than throwing an exception.)
-
nextPage
Get next page response if available- Returns:
- Returns the next page in the pagination/iteration. Next page response. Exception is throw in case no page available; call hasNextPage before to ensure is page is available
- Throws:
NoSuchElementException
- if the iteration has no more pages
-
getContent
Get the page items collection content- Returns:
- The items related to current page content
-
iterator
Get an iterator across all items available across all page responsesUnderline API (HTTP request) will be called on demand when next page content will be required to fulfill iterator with items for consecutive page
- Returns:
- Iterator onto items
-
stream
Getting a stream across all itemsUnderline API (HTTP request) will be called on demand when next page content will be required to fulfill iterator with items for consecutive page
- Returns:
- Stream onto items
-