org.apache.tapestry.util
Class SizeRestrictingIterator

java.lang.Object
  extended by org.apache.tapestry.util.SizeRestrictingIterator
All Implemented Interfaces:
Iterator

public class SizeRestrictingIterator
extends Object
implements Iterator

This class implements an Iterator which can only return a fixed number of items.


Constructor Summary
SizeRestrictingIterator(Iterator iterator)
          Constructs an Iterator which will return at most DEFAULT_MAX_SIZE items.
SizeRestrictingIterator(Iterator iterator, int maxSize)
          Constructs an Iterator which will return at most as many items as defined by the user.
 
Method Summary
 boolean hasNext()
          
 Object next()
          
 void remove()
          
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SizeRestrictingIterator

public SizeRestrictingIterator(Iterator iterator)
Constructs an Iterator which will return at most DEFAULT_MAX_SIZE items.

Parameters:
iterator - The underlying iterator this object will defer to for actual iteration.

SizeRestrictingIterator

public SizeRestrictingIterator(Iterator iterator,
                               int maxSize)
Constructs an Iterator which will return at most as many items as defined by the user.

Parameters:
iterator - The underlying iterator this object will defer to for actual iteration.
maxSize - How many items to return / filter the list by.
Method Detail

hasNext

public boolean hasNext()

Specified by:
hasNext in interface Iterator

next

public Object next()

Specified by:
next in interface Iterator

remove

public void remove()

Specified by:
remove in interface Iterator

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2006-2008 Apache Software Foundation. All Rights Reserved.