Invisible <voi### [at] devnull> wrote:
> 1. Writing
> Iterator<Foo> it = list1.iterator();
> ArrayList<Foo> list2 = new ArrayList<Foo>();
> while (it.hasNext()) list2.add(bar(it.next()));
> is way more work than writing
> list2 = map bar list1
Argument from verbosity is seldom a good argument in programming.
Just because something is shorter doesn't necessarily mean it's better.
Anyways, many languages have constructs to make that shorter. Curiously,
the next C++ standard will introduce constructs that allow you to write:
for(auto& v: list1) list2.push_back(v);
--
- Warp
Post a reply to this message
|