commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stephen Colebourne" <scolebou...@btopenworld.com>
Subject Re: [collections] CollectionUtils.index() behavior
Date Sun, 21 Sep 2003 15:15:49 GMT
Although I agree that the definition of using the Iterator is potentially
dangerous, it often works as iterators generally are consistent.

This method is one of the originals from this class, and is documented as to
what it does, so I'm -1 to changing it.

Stephen

----- Original Message -----
From: "Phil Steitz" <phil@steitz.com>
> Currently, if obj is a Map or a Collection (but not a List) and index is
> an Integer,  CollectionUtils.index(obj,index) will return the index-th
> object returned by an iterator over the map/collection. Since there is
> no guaranteed order in these cases, it does not make sense to me for
> index() to be defined in these cases.
>
> Should this be changed to either follow the "default" path (returning
> obj) or to throw an IllegalArgumentException?
>
> Phil
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>


Mime
View raw message