On Thu, 9 Jan 2003, Stephen Colebourne wrote: > Combination of the proposals: > > public interface MapIterator extends Iterator { > /** Is there another key to iterate to */ > boolean hasNext(); > /** Get the next key */ > Object next(); > /** Get the value associated with the last key retrieved from next() */ > Object getValue(); > /** Set the value associated with the last key retrieved from next() > OPTIONAL*/ > void setValue(); > /** Remove the last entry returned by next() OPTIONAL */ > void remove(); > /** Get a Map.Entry implementation for the last key retrieved */ > Map.Entry getMapEntry(); > } > > public interface ResetableIterator extends Iterator { > /** Reset the iterator back to the start */ > void reset(); > } >
Stephen, This looks good to me. > I still kindof feel that there should be a getKey() on MapIterator, although > it would duplicate next(). It doesn't really duplicate next(), since getKey() wouldn't advance the iterator. The only reason I can imagine not to have the getKey method would be to save the MapIterator the trouble of hanging on to a reference to the value returned by next(), but we'll need that anyway to support getMapEntry(). I say add getKey too. > Any advantage in defining > isSettable() > isRemovable() > on the interface? Not very collections like but perhaps useful. That's also probably difficult if not impossible to support in adapters, and like you said, isn't very collections-like. My preference would be to leave that out of the interface. - Rod > Stephen -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>