[ 
https://issues.apache.org/jira/browse/COLLECTIONS-471?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13834282#comment-13834282
 ] 

Thomas Neidhart commented on COLLECTIONS-471:
---------------------------------------------

Committed patch with some additional changes in r1546220:

 * added factory methods to be consistent with other decorators
 * added corresponding methods boundedIterator in IteratorUtils
 * remove unneeded variable firstNextCalled: pos can be used for this purpose
 * changed logic of next and hasNext slightly: avoid calling iterator.hasNext 
twice
 * do not extends AbstractIteratorDecorator: makes code slightly more readable 
by avoiding calling 
   super.hasNext and super.next and we need to implement all methods anyway 
thus no real benefit of extending the decorator.
 * javadoc updates

Thanks for this contribution!

If you have ideas for other useful iterators, feel free to create already 
another ticket.

> Add a BoundedIterator which returns at most limit elements
> ----------------------------------------------------------
>
>                 Key: COLLECTIONS-471
>                 URL: https://issues.apache.org/jira/browse/COLLECTIONS-471
>             Project: Commons Collections
>          Issue Type: New Feature
>            Reporter: Thomas Neidhart
>             Fix For: 4.0.1
>
>         Attachments: BoundedIterator.java, BoundedIteratorTest.java
>
>
> It would be nice to have a decorator which bounds the number of elements 
> returned by the decorated iterator.



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Reply via email to