Post #193,387
2/7/05 11:16:46 AM
|
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]
|
Post #193,388
2/7/05 11:18:28 AM
|
We wouldn't want programming to become too easy.
|
Post #193,427
2/7/05 1:13:05 PM
|
How?
How do you create a Collection from an Enumeration?
Collection isn't instantiable...
Regards,
-scott anderson
"Welcome to Rivendell, Mr. Anderson..."
|
Post #193,445
2/7/05 1:48:22 PM
|
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]
|
Post #193,459
2/7/05 3:39:47 PM
|
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..."
|
Post #193,480
2/7/05 5:44:05 PM
|
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
|
Post #193,486
2/7/05 5:51:33 PM
|
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]
|
Post #193,491
2/7/05 6:35:44 PM
|
As I said: bleh.
Regards,
-scott anderson
"Welcome to Rivendell, Mr. Anderson..."
|
Post #193,508
2/7/05 9:14:11 PM
|
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. |
|
Post #193,514
2/7/05 9:34:09 PM
|
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..."
|
Post #193,542
2/8/05 2:22:15 AM
|
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
|
Post #193,545
2/8/05 8:04:57 AM
|
Tell us how you really feel about Java. :-)
|
Post #193,623
2/8/05 1:13:57 PM
|
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
|