Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail From: Eric Sosman Newsgroups: comp.lang.java.programmer Subject: Re: How convert Iterator into Enumeration Date: Wed, 28 Nov 2012 13:28:13 -0500 Organization: A noiseless patient Spider Lines: 21 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Wed, 28 Nov 2012 18:28:05 +0000 (UTC) Injection-Info: mx04.eternal-september.org; posting-host="ffb8f7085759b339c1002252b48331a4"; logging-data="13491"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18KASddpMhmbGqMiH5CD5/D" User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/17.0 Thunderbird/17.0 In-Reply-To: Cancel-Lock: sha1:3hexkqI0pmy6gNZJlnYPcP+GLW0= Xref: csiph.com comp.lang.java.programmer:20008 On 11/28/2012 1:22 PM, Eric Sosman wrote: >[...] > If you do this sort of thing a lot write yourself a utility > class implementing Enumeration, with a constructor that > takes an Iterator. A companion class wrapping an Iterator > around an Enumeration is equally easy to write, and might > also be handy. (I'm a little surprised that Snoracle doesn't > provide such wrappers -- or maybe they do, but under names > that have escaped my notice.) Aha! Thanks to Jim Janney, I've just learned about the Collections#enumeration(Collection) method. It's perhaps a smidgen less general than enumeration(Iterator) would be, but only a smidgen. (And I still don't see an iterator(Enumeration) method anywhere. Maybe Santa will bring one ...) -- Eric Sosman esosman@comcast-dot-net.invalid