Path: csiph.com!usenet.pasdenom.info!gegeweb.org!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail From: Daniele Futtorovic Newsgroups: comp.lang.java.programmer Subject: Re: How convert Iterator into Enumeration Date: Sat, 01 Dec 2012 17:49:52 +0100 Organization: A noiseless patient Spider Lines: 24 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Injection-Date: Sat, 1 Dec 2012 16:49:50 +0000 (UTC) Injection-Info: mx04.eternal-september.org; posting-host="9eee1b73843abfb670cfd6dbb74b401a"; logging-data="26718"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+XRFVVBvR6gtZCa3vPN8cR" User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20120428 Thunderbird/12.0.1 In-Reply-To: Cancel-Lock: sha1:YrfxBkDopXSdiG69PhSOav7F8lg= Xref: csiph.com comp.lang.java.programmer:20034 On 28/11/2012 19:28, Eric Sosman allegedly wrote: > 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. That's been there for a while. :) Unfortunately, there's no enumeration(Iterable) support. Iterable, being a somewhat late addition, is overall poorly integrated, which is a pity. Same thing goes for CharSequence. -- DF.