On Wed, Nov 21, 2001 at 11:58:07PM -0500, [EMAIL PROTECTED] wrote:
>
> What's your view on making the EmptyIterator class a proper public class.
> Is there a strong reason for deciding that all EmptyIterators must be
> the same instance?
>
> It's probably just a style thing, but I wanted to check.
There are a few reasons:
- It parallels the set theory notion that all empty sets are really the
same empty set.
- It parallels Collections.EMPTY_[LIST|MAP|SET].
- Because it's immutable it's perfectly valid to return the same instance.
(It also offers a minimal performance gain.)
Ultimately I guess it is a matter of style. Indeed, my local implementation
is a proper class; I took the opportunity of contributing it to the Commons
as an excuse for implementing it the right way (where "right" is justified
using the above reasons). :-)
--
Christopher Elkins
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>