Note too that iterator does not support remote semantics whereas MatchSet does (all those explicit RemoteExceptions etc).
An iterator as defined for the Java platform might fail for concurrency reasons (although notably it doesn't for many of the modern concurrent collections) or because an operation (typically remove) is not supported. MatchSet semantics are substantially different. I'm sure it's still possible to do a wrapper around MatchSet that looks like an iterator but there will be some implementation cracks to pain over in respect of hiding away exceptions and so on. Dan. On 19 January 2011 07:54, Patricia Shanahan <p...@acm.org> wrote: > I don't think we should commit to a single class doing both Iterable and > Iterator. An Iterable is already committed to being able to supply an > Iterator on demand, but often the Iterator implementation is better done as > a private class member of the Iterable. Note that an Iterable needs to be > able to supply a new Iterator each time its iterator() method is called. > > I'm not sure what you are saying about combining Iterator and the MatchSet > features. My inclination would be to keep each interface simple and clean. > Many classes will implement Iterable and appropriate interfaces representing > the snapshot and lease capabilities. > > As you can probably guess from the length of this reply, I'm back from > Egypt and have a full keyboard, not just an iPhone. > > Patricia > > > > James Grahn wrote: > >> I should also add, we'd likely need to derive our own class extending >> Iterable & Iterator to avoid losing existing MatchSet methods of getSnapshot >> and getLease. >> >> I don't see an immediate problem with this; a collection-backed >> Iterable/Iterator would always have a null Lease, correct? >> >> jamesG >> >> On 1/18/2011 5:38 PM, James Grahn wrote: >> >>> It (finally) occurred to me that we can have our cake and eat it too in >>> this case. >>> >>> We can have the sweet deliciousness of API symmetry and retain the >>> implementation advantages of remote iterator & collection by having both >>> take-multiple and contents return: >>> Iterable. >>> >>>