commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lee Crawford" <>
Subject RE: [collections] Resetable iterators
Date Sat, 08 Nov 2003 21:46:40 GMT
A few things. 

On the one hand, there's nothing Iterator-specific about a reset()
method which supports a Resetable interface. However, there may be many
times where a single reference is appropriate for something that is both
Iterator and Resetable. What about providing both: 

  public interface ResetableIterator
    extends Iterator, Resetable

I know this can lead to a combinatoric explosion on interfaces if
carried to the extreme but I think you can make a reasonable case here. 

The big issue, though, is that the proper spelling is Resettable. :)


-----Original Message-----
From: Stephen Colebourne [] 
Sent: Saturday, November 08, 2003 3:12 PM
To: Jakarta Commons Developers List
Subject: [collections] Resetable iterators

The ResetableIterator interface is causing hassles as I try to tidy the
code up ready for release. Out current design requires that there is a
ResetableIterator interface for each iterator type. And there are now 5
iterator types (normal, List, Map, Ordered, OrderedMap).

I would like to remove the Resetable*Iterator interfaces and replace
with a Resetable interface. The main impact is that an instanceof/cast
check will be required to check for resetability.

Iterator it = list.iterator();;
if (it instanceof Resetable) {
  ((Resetable) it).reset();

But this is not any different to how it would be anyway, as users would
have had to check for ResetableIterator.

Any objections to me making this change?


To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message