Packages » Package util » Class Iterable

Class Iterable

Declaration:
<? interface Iterable ?>

Description:
This interface is a replacement for SPL Iterator since the latter has a somewhat strange naming. Moreover, the behaviour is also slightly different - a call to Iterable::hasMore() returns true if there are more items in the iterable, but Iterable::getNext() returns the next item AND advances the iterable so that subsequent calls to this method will fetch new items.

Authors:
  • Dennis Popel

Methods:
  • getCount()
    Get the total number of items in this iterable
  • hasMore()
    Return true if more elements available
  • next()
    Return next element and advance pointer
  • reset()
    Rewind this iterable to the before-the-first position. A call to the Iterable::getNext will fetch the first item. Note that in PaginatedIterable this method will rewind to the first item on the current page. Note: In order to avoid name collision method name has been changed. Previous name was "rewind"