NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
enumerations at least (Score:2)
At least for an enumeration you can do:
I suspect that, despite how much sense it makes, they didn't make the Iterator interface extend Iterable because it would break compatibility with a ton of custom Iterators people have coded in the years since Java 1.2. Java is extremely wary of doing this, even when doing differently (like with generics) winds up causing people pain for years.
As it is, it's pretty easy to create a wrapper class to do what ferreira suggested above, or to code something similar to the static Collections methods to consume the Iterator and return a List. Of course, if the Iterator is of the infinite variety, you might be in trouble :-)
Reply to This
Re: (Score:2)
Collections.list( enumeration )
Awesome! That is the glue I searched for in vain yesterday. Unfortunately it's too late for this particular project, but you can never have too much glue lying around for future tasks. :)
J. David works really hard, has a passion for writing good software, and knows many of the world's best Perl programmers