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

Chen commented on COLLECTIONS-698:
----------------------------------

[~belugabehr] in that case ,if we add loop control inside Iterator ,that is not 
so beautiful .maybe we should only extend the offset of begining loop.  just 
like below:
{code:java}
//代码占位符
final List<String> list = Arrays.asList("1", "2", "3","4","5"); 
final LoopingListIterator<String> loop = new LoopingListIterator<>(list,2); 
for (int loops = 0;loops < 3*list.size();loops++)
{ System.out.print(loop.next()+", "); }
{code}
 
{code:java}
//代码占位符
3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2,
{code}
 

> Expand LoopingListIterator
> --------------------------
>
>                 Key: COLLECTIONS-698
>                 URL: https://issues.apache.org/jira/browse/COLLECTIONS-698
>             Project: Commons Collections
>          Issue Type: Improvement
>          Components: Iterator
>    Affects Versions: 4.2
>            Reporter: David Mollitor
>            Priority: Minor
>
> Please enhance {{LoopingListIterator}} to accept a starting offset and a 
> number to indicate the number of loops.
> https://docs.oracle.com/javase/7/docs/api/java/util/List.html#listIterator(int)
> {code:java}
> public LoopingListIterator(List<E> list, int offset, int loops);
> {code}
> As I imagine it, if a list has 3 items (1,2,3) then 
> {{LoopingListIterator(list, 1, 1)}} would iterate: (2,3,1)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to