com.bea.p13n.pagination
Class PagedResultIterator<T>

java.lang.Object
  extended by com.bea.p13n.pagination.PagedResultIterator<T>
All Implemented Interfaces
Iterable<T>, Iterator<T>

public class PagedResultIterator<T>
extends Object
implements Iterator<T>, Iterable<T>

A wrapper around a PagedResult to iterate over the entire contents. This allows the PagedResult to retrieve data in pages (more efficient, usually), while providing a more convenient way to iterate the entire set of results, as this iterator handles the page boundaries for you.

Rules for use:


Constructor Summary
PagedResultIterator(PagedResult<T> pagedResult)
          Construct an iterator around a paged result
 
Method Summary
 boolean hasNext()
           
 Iterator<T> iterator()
          Return self so that this iterator can also be Iterable
 T next()
          Return the next item - either on the current page or by skipping to the next page.
 void remove()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PagedResultIterator

public PagedResultIterator(PagedResult<T> pagedResult)
Construct an iterator around a paged result

Parameters
pagedResult - The PagedResult to iterate
Method Detail

hasNext

public boolean hasNext()
Specified by:
hasNext in interface Iterator<T>

next

public T next()
Return the next item - either on the current page or by skipping to the next page.

Specified by:
next in interface Iterator<T>

remove

public void remove()
Specified by:
remove in interface Iterator<T>
Throws
UnsupportedOperationException - always

iterator

public Iterator<T> iterator()
Return self so that this iterator can also be Iterable

Specified by:
iterator in interface Iterable<T>
Returns
this


Copyright © 2011, Oracle. All rights reserved.