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. :)
http://www.m-w.com/cgi-bin/dictionary?va=resettable
--lee
-----Original Message-----
From: Stephen Colebourne [mailto:[EMAIL PROTECTED]
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();
it.next();
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?
Stephen
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]