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


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

Re: How convert Iterator into Enumeration

Path csiph.com!usenet.pasdenom.info!news.albasani.net!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail
From markspace <-@.>
Newsgroups comp.lang.java.programmer
Subject Re: How convert Iterator into Enumeration
Date Wed, 28 Nov 2012 13:10:21 -0800
Organization A noiseless patient Spider
Lines 27
Message-ID <k95ujv$8ki$1@dont-email.me> (permalink)
References <k94u33$2vl$1@news.albasani.net> <k95kp1$b4s$1@dont-email.me> <k95l3k$d5j$1@dont-email.me>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding 7bit
Injection-Date Wed, 28 Nov 2012 21:10:23 +0000 (UTC)
Injection-Info mx04.eternal-september.org; posting-host="61282af8d6595e8d991edb5ac03d6e00"; logging-data="8850"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18Z8bQ82+uGnhfKyhFIodl5PTi1r4ZROKQ="
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/17.0 Thunderbird/17.0
In-Reply-To <k95l3k$d5j$1@dont-email.me>
Cancel-Lock sha1:StfOVnWOBF99haFz9u4nEyJZsP0=
Xref csiph.com comp.lang.java.programmer:20014

Show key headers only | View raw


On 11/28/2012 10:28 AM, Eric Sosman wrote:

>      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 ...)


Yes, that was a useful post.  I also note some other interesting methods:

static <T> Enumeration<T> 	emptyEnumeration()
            Returns an enumeration that has no elements.

static <T> Iterator<T> 	emptyIterator()
            Returns an iterator that has no elements.

static <T> ListIterator<T> 	emptyListIterator()
            Returns a list iterator that has no elements.

There's methods to return empty collections too (List, Map, Set) as well 
as singletons for List, Map and Set, but I think more folks know about 
those.  The above methods I listed are new with Java 1.7.

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next 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