Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #20034

Re: How convert Iterator into Enumeration

From Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: How convert Iterator into Enumeration
Date 2012-12-01 17:49 +0100
Organization A noiseless patient Spider
Message-ID <k9dcfe$q2u$1@dont-email.me> (permalink)
References <k94u33$2vl$1@news.albasani.net> <k95kp1$b4s$1@dont-email.me> <k95l3k$d5j$1@dont-email.me>

Show all headers | View raw


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<T>, with a constructor that
>> takes an Iterator<T>.  A companion class wrapping an Iterator<T>
>> around an Enumeration<T> 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.

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

How convert Iterator into Enumeration Jan Burse <janburse@fastmail.fm> - 2012-11-28 12:55 +0100
  Re: How convert Iterator into Enumeration Roedy Green <see_website@mindprod.com.invalid> - 2012-11-28 05:22 -0800
    Re: How convert Iterator into Enumeration Wanja Gayk <brixomatic@yahoo.com> - 2012-11-30 20:23 +0100
  Re: How convert Iterator into Enumeration Jim Janney <jjanney@shell.xmission.com> - 2012-11-28 08:53 -0700
    Re: How convert Iterator into Enumeration Jim Janney <jjanney@shell.xmission.com> - 2012-11-28 11:11 -0700
      Re: How convert Iterator into Enumeration Roedy Green <see_website@mindprod.com.invalid> - 2012-11-28 12:36 -0800
        Re: How convert Iterator into Enumeration Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-11-28 13:00 -0800
        Re: How convert Iterator into Enumeration Jim Janney <jjanney@shell.xmission.com> - 2012-11-28 14:01 -0700
    Re: How convert Iterator into Enumeration Roedy Green <see_website@mindprod.com.invalid> - 2012-11-28 12:38 -0800
  Re: How convert Iterator into Enumeration Eric Sosman <esosman@comcast-dot-net.invalid> - 2012-11-28 13:22 -0500
    Re: How convert Iterator into Enumeration Eric Sosman <esosman@comcast-dot-net.invalid> - 2012-11-28 13:28 -0500
      Re: How convert Iterator into Enumeration markspace <-@.> - 2012-11-28 13:10 -0800
      Re: How convert Iterator into Enumeration Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2012-12-01 17:49 +0100

csiph-web