IWETHEY v. 0.3.0 | TODO
1,095 registered users | 1 active user | 0 LpH | Statistics
Login | Create New User
IWETHEY Banner

Welcome to IWETHEY!

New Unbelievable!
In Java, one can construct a Collection from Enumeration with a single call. But Enumeration is an obsolete interface, one is supposed to use Iterator. Well, guess what, there is no call to construct a Collection from Iterator. Grrrrr.
--


- I was involuntarily self-promoted into management.

[link|http://kerneltrap.org/node/4484|Richard Stallman]

New We wouldn't want programming to become too easy.
New How?
How do you create a Collection from an Enumeration?

Collection isn't instantiable...
Regards,

-scott anderson

"Welcome to Rivendell, Mr. Anderson..."
New OK, not EXACTLY Collection
Shhesh

static ArrayList list(Enumeration e)
Returns an array list containing the elements returned by the specified enumeration in the order they are returned by the enumeration.
--


- I was involuntarily self-promoted into management.

[link|http://kerneltrap.org/node/4484|Richard Stallman]

New Oh, got it.
I didn't realize that Collections had that method.

That's a nasty little omission. I guess you could make an object wrapper for Iterator that implemented the Enumeration interface:

\npublic IteratorEnumeration implements Enumeration\n{\n    private Iterator wrapped = null;\n    public IteratorEnumeration(Iterator iter) { this.wrapped = iter; }\n\n    public boolean hasMoreElements() { return this.wrapped.hasNext(); }\n    public Object nextElement() { return this.wrapped.next(); }\n}\n


Then you could do:
\nArrayList a = Collections.list(new IteratorEnumeration(myIter));\n

Bleh.
Regards,

-scott anderson

"Welcome to Rivendell, Mr. Anderson..."
New Oh yes, lets make another class
Heck lets make a dozen of them. Might as well since that's the only mechanism for extension there is in the silly language.

class class class class class class class class class class class class.

Whee!

Now all it needs is an XML descriptor.



"Whenever you find you are on the side of the majority, it is time to pause and reflect"   --Mark Twain

"The significant problems we face cannot be solved at the same level of thinking we were at when we created them."   --Albert Einstein

"This is still a dangerous world. It's a world of madmen and uncertainty and potential mental losses."   --George W. Bush
New ICRPD (new thread)
Created as new thread #193485 titled [link|/forums/render/content/show?contentid=193485|ICRPD]
--


- I was involuntarily self-promoted into management.

[link|http://kerneltrap.org/node/4484|Richard Stallman]

New As I said: bleh.
Regards,

-scott anderson

"Welcome to Rivendell, Mr. Anderson..."
New If I ever have to program Java...
... I'm going to point to this forum as evidence that I don't want to do that.

Wade.

Is it enough to love
Is it enough to breathe
Somebody rip my heart out
And leave me here to bleed
 
Is it enough to die
Somebody save my life
I'd rather be Anything but Ordinary
Please

-- "Anything but Ordinary" by Avril Lavigne.

New All languages have warts.
Perl, Python, and Smalltalk are no exceptions. Java gets a lot of heat because it's so widespread. It beats the hell out of C++ and VB as far as I'm concerned, and since that's the choice you get in most business environments, I'm more than glad to pick Java.
Regards,

-scott anderson

"Welcome to Rivendell, Mr. Anderson..."
New Some are worse
than [link|http://www.rednova.com/news/display/?id=53608|others] though.



"Whenever you find you are on the side of the majority, it is time to pause and reflect"   --Mark Twain

"The significant problems we face cannot be solved at the same level of thinking we were at when we created them."   --Albert Einstein

"This is still a dangerous world. It's a world of madmen and uncertainty and potential mental losses."   --George W. Bush
New Tell us how you really feel about Java. :-)
New Oh, its OK
in the same way that typing with your feet while wearing socks is OK.



"Whenever you find you are on the side of the majority, it is time to pause and reflect"   --Mark Twain

"The significant problems we face cannot be solved at the same level of thinking we were at when we created them."   --Albert Einstein

"This is still a dangerous world. It's a world of madmen and uncertainty and potential mental losses."   --George W. Bush
     Unbelievable! - (Arkadiy) - (12)
         We wouldn't want programming to become too easy. -NT - (ChrisR)
         How? - (admin) - (10)
             OK, not EXACTLY Collection - (Arkadiy) - (9)
                 Oh, got it. - (admin) - (8)
                     Oh yes, lets make another class - (tuberculosis) - (7)
                         ICRPD (new thread) - (Arkadiy)
                         As I said: bleh. -NT - (admin)
                         If I ever have to program Java... - (static) - (4)
                             All languages have warts. - (admin) - (3)
                                 Some are worse - (tuberculosis) - (2)
                                     Tell us how you really feel about Java. :-) -NT - (Another Scott) - (1)
                                         Oh, its OK - (tuberculosis)

How?
52 ms