You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Henri Yandell <ba...@generationjava.com> on 2002/06/18 20:17:44 UTC
[collections] ArrayIterator
I'd like to add some overloaded constructors and setArray methods to
ArrayIterator which allow the start and end indices to be set.
I found that really useful recently.
Anyone -1 on that? I admit that it could have been done quite happily by
building a smaller array.
Hen
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: [collections] ArrayIterator
Posted by Henri Yandell <ba...@generationjava.com>.
Constructor overloaded. I chose to throw some RuntimeExceptions if the
arguments passed in are illegal [ArrayOutOfBoundsException if they pass in
an index outside the array or IllegalArgumentException if the start index
is >= the end index..]
Let me know if those Exceptions are -1'd by anyone.
Hen
On Tue, 18 Jun 2002, Henri Yandell wrote:
>
>
> On Tue, 18 Jun 2002, Michael A. Smith wrote:
>
> > no objections to overloading the constructors. I'm a bit concerned
> > about the setArray method though. I don't think it should exist in the
> > first place, and adding more just makes it worse in my opinion -- you
> > sholdn't be able to change the underlying array while iterating because
> > it will result in unpredictable behavior. Using an empty constructor
> > and a setArray is analogous to making the ArrayIterator a bean, but an
> > iterator should not be a bean -- it's not data. Just my opinion I
> > guess...
>
> I'm +1 on not having the setArray [though I guess we have to deprecate it
> etc]. Will just overload the constructor.
>
> Hen
>
>
> --
> To unsubscribe, e-mail: <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: [collections] ArrayIterator
Posted by Henri Yandell <ba...@generationjava.com>.
On Tue, 18 Jun 2002, Michael A. Smith wrote:
> no objections to overloading the constructors. I'm a bit concerned
> about the setArray method though. I don't think it should exist in the
> first place, and adding more just makes it worse in my opinion -- you
> sholdn't be able to change the underlying array while iterating because
> it will result in unpredictable behavior. Using an empty constructor
> and a setArray is analogous to making the ArrayIterator a bean, but an
> iterator should not be a bean -- it's not data. Just my opinion I
> guess...
I'm +1 on not having the setArray [though I guess we have to deprecate it
etc]. Will just overload the constructor.
Hen
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: [collections] ArrayIterator
Posted by "Michael A. Smith" <ma...@apache.org>.
On Tue, 18 Jun 2002, Henri Yandell wrote:
> I'd like to add some overloaded constructors and setArray methods to
> ArrayIterator which allow the start and end indices to be set.
> I found that really useful recently.
no objections to overloading the constructors. I'm a bit concerned
about the setArray method though. I don't think it should exist in the
first place, and adding more just makes it worse in my opinion -- you
sholdn't be able to change the underlying array while iterating because
it will result in unpredictable behavior. Using an empty constructor
and a setArray is analogous to making the ArrayIterator a bean, but an
iterator should not be a bean -- it's not data. Just my opinion I
guess...
michael
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>