T - the type of items on each pagepublic abstract class PagedIterable<T> extends Object implements Iterable<T>
Iterable that returns PagedIterator. PagedIterable is thread-safe but PagedIterator
is not. Any one instance of PagedIterator should only be called from a single thread.| Constructor and Description |
|---|
PagedIterable() |
| Modifier and Type | Method and Description |
|---|---|
abstract PagedIterator<T> |
_iterator(int pageSize)
Iterator over page items.
|
List<T> |
asList()
Eagerly walk
Iterable and return the result in a list. |
Set<T> |
asSet()
Eagerly walk
Iterable and return the result in a set. |
PagedIterator<T> |
iterator()
Returns an iterator over elements of type
T. |
T[] |
toArray()
Eagerly walk
Iterable and return the result in an array. |
protected T[] |
toArray(PagedIterator<T> iterator)
Eagerly walk
PagedIterator and return the result in an array. |
PagedIterable<T> |
withPageSize(int size)
Sets the pagination size.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEach, spliteratorpublic PagedIterable<T> withPageSize(int size)
When set to non-zero, each API call will retrieve this many entries.
size - the size@Nonnull public final PagedIterator<T> iterator()
T.@Nonnull public abstract PagedIterator<T> _iterator(int pageSize)
pageSize - the page sizeprotected T[] toArray(PagedIterator<T> iterator) throws IOException
PagedIterator and return the result in an array.iterator - the PagedIterator to readPagedIteratorIOException - if an I/O exception occurs.@Nonnull public T[] toArray() throws IOException
Iterable and return the result in an array.IOException - if an I/O exception occurs.@Nonnull public List<T> asList()
Iterable and return the result in a list.Copyright © 2020. All rights reserved.