[jira] Commented: (COLLECTIONS-246) LoopingListIterator behaves unexpected on next and previous mixed

2008-04-15 Thread Stephen Colebourne (JIRA)

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

Stephen Colebourne commented on COLLECTIONS-246:


Could everyone please read the javadoc for ListIterator.
http://java.sun.com/javase/6/docs/api/java/util/ListIterator.html#previous()

next() followed by previous() return the same value.

> LoopingListIterator behaves unexpected on next and previous mixed
> -
>
> Key: COLLECTIONS-246
> URL: https://issues.apache.org/jira/browse/COLLECTIONS-246
> Project: Commons Collections
>  Issue Type: Bug
>  Components: Iterator
>Affects Versions: 3.2
> Environment: JDK 1.4.2_12 
> Common Collections 3.2
>Reporter: Frank Hefter
>Priority: Blocker
> Fix For: 3.3
>
> Attachments: LoopingListIterator.java, LoopingListIterator.java, 
> LoopingListIteratorTest.java
>
>
> Using ArrayList as the backing list. 
> This combination at least returns unexpected results as you can see in the 
> testcase below.
> I used this for a list navigator in a web frontend and had trouble with users.
> I suspect java.util.AbstrList$ListItr (role of "cursor" var seems to be wrong 
> implemented ) to cause this problem. If so maybe we have to implement it in a 
> different way.
> Testcase (it runs without hassle but the comments show whats wrong):
> ---
> import java.util.ArrayList;
> import junit.framework.TestCase;
> import org.apache.commons.collections.iterators.LoopingListIterator;
> public class SelectionControllerTest extends TestCase {
> public void testSelectorForApache() {
> ArrayList al = new ArrayList();
> al.add("0"); al.add("1"); al.add("2");
> LoopingListIterator it = new  LoopingListIterator(al);
> assertEquals("0", it.next()); // This is OK
> // here I am on "0"
> assertEquals("0", it.previous()); // Wrong ! This should be 2!
> //  here I am on "0" too! This is wrong.
> assertEquals("2", it.previous());
> assertEquals("1", it.previous());
> assertEquals("0", it.previous());
> assertEquals("2", it.previous());
> // here I am on "2" 
> assertEquals("2", it.next()); // Wrong ! This should be 0!
> // here I am on "2" too! This is wrong.
> assertEquals("0", it.next()); 
> assertEquals("1", it.next());
> // here I am on "1" 
> assertEquals("1", it.previous()); // Wrong ! This should be 0!
> }
> }
> ---
> Thanks for your help.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (COLLECTIONS-246) LoopingListIterator behaves unexpected on next and previous mixed

2008-04-14 Thread Frank Hefter (JIRA)

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

Frank Hefter commented on COLLECTIONS-246:
--


1. it.next() returns "0" this means the iterator is ON (not before or after) "0"
2. it.previous() should return the value before "0" - this is "2"

There is no before or after! What for ?

Following you opinion a  
it.next() 
it.previous 
it.next() 
it.previous 
it.next() 
a.s.o. 
should always return the same value. I would like to see this commands as 
button to navigate through a list. Would a user that press these button expect 
to stay at the same place? For sure not.

I think thats the mistake of your thinking. A command has to move the iterator. 
The former error was that I was not able to predict that.

Hope it clear now.


> LoopingListIterator behaves unexpected on next and previous mixed
> -
>
> Key: COLLECTIONS-246
> URL: https://issues.apache.org/jira/browse/COLLECTIONS-246
> Project: Commons Collections
>  Issue Type: Bug
>  Components: Iterator
>Affects Versions: 3.2
> Environment: JDK 1.4.2_12 
> Common Collections 3.2
>Reporter: Frank Hefter
>Priority: Blocker
> Fix For: 3.3
>
> Attachments: LoopingListIterator.java, LoopingListIterator.java, 
> LoopingListIteratorTest.java
>
>
> Using ArrayList as the backing list. 
> This combination at least returns unexpected results as you can see in the 
> testcase below.
> I used this for a list navigator in a web frontend and had trouble with users.
> I suspect java.util.AbstrList$ListItr (role of "cursor" var seems to be wrong 
> implemented ) to cause this problem. If so maybe we have to implement it in a 
> different way.
> Testcase (it runs without hassle but the comments show whats wrong):
> ---
> import java.util.ArrayList;
> import junit.framework.TestCase;
> import org.apache.commons.collections.iterators.LoopingListIterator;
> public class SelectionControllerTest extends TestCase {
> public void testSelectorForApache() {
> ArrayList al = new ArrayList();
> al.add("0"); al.add("1"); al.add("2");
> LoopingListIterator it = new  LoopingListIterator(al);
> assertEquals("0", it.next()); // This is OK
> // here I am on "0"
> assertEquals("0", it.previous()); // Wrong ! This should be 2!
> //  here I am on "0" too! This is wrong.
> assertEquals("2", it.previous());
> assertEquals("1", it.previous());
> assertEquals("0", it.previous());
> assertEquals("2", it.previous());
> // here I am on "2" 
> assertEquals("2", it.next()); // Wrong ! This should be 0!
> // here I am on "2" too! This is wrong.
> assertEquals("0", it.next()); 
> assertEquals("1", it.next());
> // here I am on "1" 
> assertEquals("1", it.previous()); // Wrong ! This should be 0!
> }
> }
> ---
> Thanks for your help.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (COLLECTIONS-246) LoopingListIterator behaves unexpected on next and previous mixed

2008-04-05 Thread Henri Yandell (JIRA)

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

Henri Yandell commented on COLLECTIONS-246:
---

Can you restate your failing test? Looking at the description, I was taking it 
as:

{code:java}
ArrayList al = new ArrayList(); 
al.add("0"); 
al.add("1"); 
al.add("2"); 
LoopingListIterator it = new LoopingListIterator(al); 
assertEquals("0", it.next()); // This is OK 
// here I am on "0" 
assertEquals("0", it.previous()); // Wrong ! This should be 2! 
{code}

Your statement here is incorrect - the answer should be 0 not 2. This is the 
base of your misunderstanding - you are not "on 0", you are "before 0". I think 
that's a part of the java.util.Iterator concept; and that we shouldn't 
implement an alternative to java.util.Iterator as it would lead to having to 
write lots of code.

> LoopingListIterator behaves unexpected on next and previous mixed
> -
>
> Key: COLLECTIONS-246
> URL: https://issues.apache.org/jira/browse/COLLECTIONS-246
> Project: Commons Collections
>  Issue Type: Bug
>  Components: Iterator
>Affects Versions: 3.2
> Environment: JDK 1.4.2_12 
> Common Collections 3.2
>Reporter: Frank Hefter
>Priority: Blocker
> Fix For: 3.3
>
> Attachments: LoopingListIterator.java, LoopingListIterator.java, 
> LoopingListIteratorTest.java
>
>
> Using ArrayList as the backing list. 
> This combination at least returns unexpected results as you can see in the 
> testcase below.
> I used this for a list navigator in a web frontend and had trouble with users.
> I suspect java.util.AbstrList$ListItr (role of "cursor" var seems to be wrong 
> implemented ) to cause this problem. If so maybe we have to implement it in a 
> different way.
> Testcase (it runs without hassle but the comments show whats wrong):
> ---
> import java.util.ArrayList;
> import junit.framework.TestCase;
> import org.apache.commons.collections.iterators.LoopingListIterator;
> public class SelectionControllerTest extends TestCase {
> public void testSelectorForApache() {
> ArrayList al = new ArrayList();
> al.add("0"); al.add("1"); al.add("2");
> LoopingListIterator it = new  LoopingListIterator(al);
> assertEquals("0", it.next()); // This is OK
> // here I am on "0"
> assertEquals("0", it.previous()); // Wrong ! This should be 2!
> //  here I am on "0" too! This is wrong.
> assertEquals("2", it.previous());
> assertEquals("1", it.previous());
> assertEquals("0", it.previous());
> assertEquals("2", it.previous());
> // here I am on "2" 
> assertEquals("2", it.next()); // Wrong ! This should be 0!
> // here I am on "2" too! This is wrong.
> assertEquals("0", it.next()); 
> assertEquals("1", it.next());
> // here I am on "1" 
> assertEquals("1", it.previous()); // Wrong ! This should be 0!
> }
> }
> ---
> Thanks for your help.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (COLLECTIONS-246) LoopingListIterator behaves unexpected on next and previous mixed

2008-04-02 Thread Frank Hefter (JIRA)

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

Frank Hefter commented on COLLECTIONS-246:
--

For my opinion this test case is to simple and can't be compared with the more 
complex swap over at the beginning and the end of this LoopingList (thats the 
error I ment btw. !).

You simply take a java.util.Iterator test. But this ignores the abilities of 
this class comletely.

Again, please give me test cases that are better than mine. 

Also your test works with this fix, too. So it is an iterator? Right?

Just for the case: I don't care about the implementation. Just my tests have to 
apply.
So we can focus on the tests and make them more complexe. 

Is there a LoopIterator pattern somewhere? If not: Let's create it !

> LoopingListIterator behaves unexpected on next and previous mixed
> -
>
> Key: COLLECTIONS-246
> URL: https://issues.apache.org/jira/browse/COLLECTIONS-246
> Project: Commons Collections
>  Issue Type: Bug
>  Components: Iterator
>Affects Versions: 3.2
> Environment: JDK 1.4.2_12 
> Common Collections 3.2
>Reporter: Frank Hefter
>Priority: Blocker
> Fix For: 3.3
>
> Attachments: LoopingListIterator.java, LoopingListIterator.java, 
> LoopingListIteratorTest.java
>
>
> Using ArrayList as the backing list. 
> This combination at least returns unexpected results as you can see in the 
> testcase below.
> I used this for a list navigator in a web frontend and had trouble with users.
> I suspect java.util.AbstrList$ListItr (role of "cursor" var seems to be wrong 
> implemented ) to cause this problem. If so maybe we have to implement it in a 
> different way.
> Testcase (it runs without hassle but the comments show whats wrong):
> ---
> import java.util.ArrayList;
> import junit.framework.TestCase;
> import org.apache.commons.collections.iterators.LoopingListIterator;
> public class SelectionControllerTest extends TestCase {
> public void testSelectorForApache() {
> ArrayList al = new ArrayList();
> al.add("0"); al.add("1"); al.add("2");
> LoopingListIterator it = new  LoopingListIterator(al);
> assertEquals("0", it.next()); // This is OK
> // here I am on "0"
> assertEquals("0", it.previous()); // Wrong ! This should be 2!
> //  here I am on "0" too! This is wrong.
> assertEquals("2", it.previous());
> assertEquals("1", it.previous());
> assertEquals("0", it.previous());
> assertEquals("2", it.previous());
> // here I am on "2" 
> assertEquals("2", it.next()); // Wrong ! This should be 0!
> // here I am on "2" too! This is wrong.
> assertEquals("0", it.next()); 
> assertEquals("1", it.next());
> // here I am on "1" 
> assertEquals("1", it.previous()); // Wrong ! This should be 0!
> }
> }
> ---
> Thanks for your help.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (COLLECTIONS-246) LoopingListIterator behaves unexpected on next and previous mixed

2008-04-01 Thread Henri Yandell (JIRA)

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

Henri Yandell commented on COLLECTIONS-246:
---


The basic case that I think that has to be expected is:

{code:java}
Object o1 = it.next();
Object o2 = it.previous();

assertTrue(o1 == o2) 
{code}

".next()" moves the current position. So it's right for the it.previous() to 
return "0" and not "2". 

Previously I suggested that a different approach of getNext and moveToNext 
might be useful, but that would a) confuse by adding a duplicate layer and b) 
would not match the Collections API java.util.Iterator pattern. So I don't 
think there's anything to do here - the iterators work to the same pattern as 
the JDK's Iterator.

> LoopingListIterator behaves unexpected on next and previous mixed
> -
>
> Key: COLLECTIONS-246
> URL: https://issues.apache.org/jira/browse/COLLECTIONS-246
> Project: Commons Collections
>  Issue Type: Bug
>  Components: Iterator
>Affects Versions: 3.2
> Environment: JDK 1.4.2_12 
> Common Collections 3.2
>Reporter: Frank Hefter
>Priority: Blocker
> Fix For: 3.3
>
> Attachments: LoopingListIterator.java, LoopingListIterator.java, 
> LoopingListIteratorTest.java
>
>
> Using ArrayList as the backing list. 
> This combination at least returns unexpected results as you can see in the 
> testcase below.
> I used this for a list navigator in a web frontend and had trouble with users.
> I suspect java.util.AbstrList$ListItr (role of "cursor" var seems to be wrong 
> implemented ) to cause this problem. If so maybe we have to implement it in a 
> different way.
> Testcase (it runs without hassle but the comments show whats wrong):
> ---
> import java.util.ArrayList;
> import junit.framework.TestCase;
> import org.apache.commons.collections.iterators.LoopingListIterator;
> public class SelectionControllerTest extends TestCase {
> public void testSelectorForApache() {
> ArrayList al = new ArrayList();
> al.add("0"); al.add("1"); al.add("2");
> LoopingListIterator it = new  LoopingListIterator(al);
> assertEquals("0", it.next()); // This is OK
> // here I am on "0"
> assertEquals("0", it.previous()); // Wrong ! This should be 2!
> //  here I am on "0" too! This is wrong.
> assertEquals("2", it.previous());
> assertEquals("1", it.previous());
> assertEquals("0", it.previous());
> assertEquals("2", it.previous());
> // here I am on "2" 
> assertEquals("2", it.next()); // Wrong ! This should be 0!
> // here I am on "2" too! This is wrong.
> assertEquals("0", it.next()); 
> assertEquals("1", it.next());
> // here I am on "1" 
> assertEquals("1", it.previous()); // Wrong ! This should be 0!
> }
> }
> ---
> Thanks for your help.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (COLLECTIONS-246) LoopingListIterator behaves unexpected on next and previous mixed

2008-03-25 Thread Henri Yandell (JIRA)

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

Henri Yandell commented on COLLECTIONS-246:
---

I don't see us changing LoopingListIterator itself. The question is whether we 
add a different type of Iterator. It would also mean a different kind of 
OrderedIterator.

I'm suspecting this is a WONTFIX, accepting it as a facet of the design.

> LoopingListIterator behaves unexpected on next and previous mixed
> -
>
> Key: COLLECTIONS-246
> URL: https://issues.apache.org/jira/browse/COLLECTIONS-246
> Project: Commons Collections
>  Issue Type: Bug
>  Components: Iterator
>Affects Versions: 3.2
> Environment: JDK 1.4.2_12 
> Common Collections 3.2
>Reporter: Frank Hefter
>Priority: Blocker
> Fix For: 3.3
>
> Attachments: LoopingListIterator.java, LoopingListIterator.java, 
> LoopingListIteratorTest.java
>
>
> Using ArrayList as the backing list. 
> This combination at least returns unexpected results as you can see in the 
> testcase below.
> I used this for a list navigator in a web frontend and had trouble with users.
> I suspect java.util.AbstrList$ListItr (role of "cursor" var seems to be wrong 
> implemented ) to cause this problem. If so maybe we have to implement it in a 
> different way.
> Testcase (it runs without hassle but the comments show whats wrong):
> ---
> import java.util.ArrayList;
> import junit.framework.TestCase;
> import org.apache.commons.collections.iterators.LoopingListIterator;
> public class SelectionControllerTest extends TestCase {
> public void testSelectorForApache() {
> ArrayList al = new ArrayList();
> al.add("0"); al.add("1"); al.add("2");
> LoopingListIterator it = new  LoopingListIterator(al);
> assertEquals("0", it.next()); // This is OK
> // here I am on "0"
> assertEquals("0", it.previous()); // Wrong ! This should be 2!
> //  here I am on "0" too! This is wrong.
> assertEquals("2", it.previous());
> assertEquals("1", it.previous());
> assertEquals("0", it.previous());
> assertEquals("2", it.previous());
> // here I am on "2" 
> assertEquals("2", it.next()); // Wrong ! This should be 0!
> // here I am on "2" too! This is wrong.
> assertEquals("0", it.next()); 
> assertEquals("1", it.next());
> // here I am on "1" 
> assertEquals("1", it.previous()); // Wrong ! This should be 0!
> }
> }
> ---
> Thanks for your help.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (COLLECTIONS-246) LoopingListIterator behaves unexpected on next and previous mixed

2008-03-18 Thread Frank Hefter (JIRA)

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

Frank Hefter commented on COLLECTIONS-246:
--

Hallo Henri,

I'm not able to check in the changes into SVN since my connections here at work 
are very restrictive and at home I have no computer with a dev system set up.
Could you or someone else check in the changes for me?

Just copy all and past.

Thanks, 
  Frank








> LoopingListIterator behaves unexpected on next and previous mixed
> -
>
> Key: COLLECTIONS-246
> URL: https://issues.apache.org/jira/browse/COLLECTIONS-246
> Project: Commons Collections
>  Issue Type: Bug
>  Components: Iterator
>Affects Versions: 3.2
> Environment: JDK 1.4.2_12 
> Common Collections 3.2
>Reporter: Frank Hefter
>Priority: Blocker
> Fix For: 3.3
>
> Attachments: LoopingListIterator.java, LoopingListIterator.java, 
> LoopingListIteratorTest.java
>
>
> Using ArrayList as the backing list. 
> This combination at least returns unexpected results as you can see in the 
> testcase below.
> I used this for a list navigator in a web frontend and had trouble with users.
> I suspect java.util.AbstrList$ListItr (role of "cursor" var seems to be wrong 
> implemented ) to cause this problem. If so maybe we have to implement it in a 
> different way.
> Testcase (it runs without hassle but the comments show whats wrong):
> ---
> import java.util.ArrayList;
> import junit.framework.TestCase;
> import org.apache.commons.collections.iterators.LoopingListIterator;
> public class SelectionControllerTest extends TestCase {
> public void testSelectorForApache() {
> ArrayList al = new ArrayList();
> al.add("0"); al.add("1"); al.add("2");
> LoopingListIterator it = new  LoopingListIterator(al);
> assertEquals("0", it.next()); // This is OK
> // here I am on "0"
> assertEquals("0", it.previous()); // Wrong ! This should be 2!
> //  here I am on "0" too! This is wrong.
> assertEquals("2", it.previous());
> assertEquals("1", it.previous());
> assertEquals("0", it.previous());
> assertEquals("2", it.previous());
> // here I am on "2" 
> assertEquals("2", it.next()); // Wrong ! This should be 0!
> // here I am on "2" too! This is wrong.
> assertEquals("0", it.next()); 
> assertEquals("1", it.next());
> // here I am on "1" 
> assertEquals("1", it.previous()); // Wrong ! This should be 0!
> }
> }
> ---
> Thanks for your help.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (COLLECTIONS-246) LoopingListIterator behaves unexpected on next and previous mixed

2007-11-12 Thread Frank Hefter (JIRA)

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

Frank Hefter commented on COLLECTIONS-246:
--

I don't want to make a new attachment for a small but useful addition. Maybe 
the next editor can add these lines then:
---
 /**
 * Just indicates the selection of the first entry in the list. 
 * This is good to indicate that the start of the list has been reached.
 * @return
 * @version initial Frank Hefter 2007-11-12
 */
public boolean isFirst() {
return currentIndex<=0;
}

/**
 * Just indicates the selection of the last entry in the list. 
 * This is good to indicate that the end of the list has been reached.
 * @return
 * @version initial Frank Hefter 2007-11-12
 */
public boolean isLast() {
return currentIndex>=list.size()-1;
}
---


> LoopingListIterator behaves unexpected on next and previous mixed
> -
>
> Key: COLLECTIONS-246
> URL: https://issues.apache.org/jira/browse/COLLECTIONS-246
> Project: Commons Collections
>  Issue Type: Bug
>  Components: Iterator
>Affects Versions: 3.2
> Environment: JDK 1.4.2_12 
> Common Collections 3.2
>Reporter: Frank Hefter
>Priority: Blocker
> Attachments: LoopingListIterator.java, LoopingListIterator.java, 
> LoopingListIterator.java, LoopingListIteratorTest.java
>
>
> Using ArrayList as the backing list. 
> This combination at least returns unexpected results as you can see in the 
> testcase below.
> I used this for a list navigator in a web frontend and had trouble with users.
> I suspect java.util.AbstrList$ListItr (role of "cursor" var seems to be wrong 
> implemented ) to cause this problem. If so maybe we have to implement it in a 
> different way.
> Testcase (it runs without hassle but the comments show whats wrong):
> ---
> import java.util.ArrayList;
> import junit.framework.TestCase;
> import org.apache.commons.collections.iterators.LoopingListIterator;
> public class SelectionControllerTest extends TestCase {
> public void testSelectorForApache() {
> ArrayList al = new ArrayList();
> al.add("0"); al.add("1"); al.add("2");
> LoopingListIterator it = new  LoopingListIterator(al);
> assertEquals("0", it.next()); // This is OK
> // here I am on "0"
> assertEquals("0", it.previous()); // Wrong ! This should be 2!
> //  here I am on "0" too! This is wrong.
> assertEquals("2", it.previous());
> assertEquals("1", it.previous());
> assertEquals("0", it.previous());
> assertEquals("2", it.previous());
> // here I am on "2" 
> assertEquals("2", it.next()); // Wrong ! This should be 0!
> // here I am on "2" too! This is wrong.
> assertEquals("0", it.next()); 
> assertEquals("1", it.next());
> // here I am on "1" 
> assertEquals("1", it.previous()); // Wrong ! This should be 0!
> }
> }
> ---
> Thanks for your help.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (COLLECTIONS-246) LoopingListIterator behaves unexpected on next and previous mixed

2007-11-12 Thread Frank Hefter (JIRA)

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

Frank Hefter commented on COLLECTIONS-246:
--

Please ignore my last attachment. I'm working on the right one.

> LoopingListIterator behaves unexpected on next and previous mixed
> -
>
> Key: COLLECTIONS-246
> URL: https://issues.apache.org/jira/browse/COLLECTIONS-246
> Project: Commons Collections
>  Issue Type: Bug
>  Components: Iterator
>Affects Versions: 3.2
> Environment: JDK 1.4.2_12 
> Common Collections 3.2
>Reporter: Frank Hefter
>Priority: Blocker
> Attachments: LoopingListIterator.java, LoopingListIterator.java
>
>
> Using ArrayList as the backing list. 
> This combination at least returns unexpected results as you can see in the 
> testcase below.
> I used this for a list navigator in a web frontend and had trouble with users.
> I suspect java.util.AbstrList$ListItr (role of "cursor" var seems to be wrong 
> implemented ) to cause this problem. If so maybe we have to implement it in a 
> different way.
> Testcase (it runs without hassle but the comments show whats wrong):
> ---
> import java.util.ArrayList;
> import junit.framework.TestCase;
> import org.apache.commons.collections.iterators.LoopingListIterator;
> public class SelectionControllerTest extends TestCase {
> public void testSelectorForApache() {
> ArrayList al = new ArrayList();
> al.add("0"); al.add("1"); al.add("2");
> LoopingListIterator it = new  LoopingListIterator(al);
> assertEquals("0", it.next()); // This is OK
> // here I am on "0"
> assertEquals("0", it.previous()); // Wrong ! This should be 2!
> //  here I am on "0" too! This is wrong.
> assertEquals("2", it.previous());
> assertEquals("1", it.previous());
> assertEquals("0", it.previous());
> assertEquals("2", it.previous());
> // here I am on "2" 
> assertEquals("2", it.next()); // Wrong ! This should be 0!
> // here I am on "2" too! This is wrong.
> assertEquals("0", it.next()); 
> assertEquals("1", it.next());
> // here I am on "1" 
> assertEquals("1", it.previous()); // Wrong ! This should be 0!
> }
> }
> ---
> Thanks for your help.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.