Details
-
Improvement
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
1.5.1
-
None
-
None
Description
[1,2,3].sum() works nicely.
But [1,2,3].iterator().sum() fails.
In contrast, this code
[1,2,3].iterator().each {
println it
}
works just fine.
On aesthetic grounds, there shouldn't be any difference in what works and what doesn't. More importantly, there are situations where an iterator is available (due to pre-existing API's) but a collection is not.