| 73 | } |
| 74 | |
| 75 | @Override |
| 76 | public boolean hasNext() { |
| 77 | while (nextData == null && ioException == null && this.continuation != null && this.count < this.itemLimit) { |
| 78 | retrieveNextPage(); |
| 79 | } |
| 80 | |
| 81 | // If an IOException occurred, we return true to indicate another element is available. However, next() will |
| 82 | // then throw a NoSuchElementException with the IOException as cause. The motivation for this is keeping the |
| 83 | // public API backwards compatible. |
| 84 | return nextData != null || ioException != null; |
| 85 | } |
| 86 | |
| 87 | @Override |
| 88 | public Collection<T> next() throws NoSuchElementException { |