I just noticed that ArrayListIterator is marked as @since 2.2. This should be 3.0, right (i.e. 2.2 was never released)?

One way to fix the problem (assuming that others agree that it is a "problem" ;-) involves changing the way that ArrayIterator (which is @since 1.0) internally manages its protected index field. The changes would result in no difference in behavior for ArrayIterator's public methods, but since index is protected, users who have subclassed ArrayIterator could conceivably be impacted. What is the policy on these kinds of changes? Would this count as an "incompatible change"?

Phil


Phil Steitz wrote:
Sorry. Forgot the prefix...

Phil Steitz wrote:

If an ArrayListIterator or ObjectArrayListIterator is constructed from an array with an offset, the internal index is initialized and maintained relative to the array offset. For example, if we create a ListIterator like so:

Object[] objArray = {"a", "b", "c", "d"};
ListIterator iterator = IteratorUtils.arrayListIterator(objArray, 3);

iterator.previousIndex() returns 2 if called immediatly. On the other hand, iterator.hasPrevious() returns false in this case. This seems inconsistent with the ListIterator API.

I think that when the ListIterator is constructed, previousIndex should return -1 and it should be maintained relative the the "visible" portion of the underlying array, so that the ListIterator acts just like a ListIterator formed using a copy of the subarray. Any reason not to change this?

Phil




--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to