Details
-
Improvement
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
None
-
None
Description
Currently multiple-assignment is implemented using getAt(int). For types that support getAt(IntRange) it may be more efficient to use that operation. For cases where getAt(int) is a terminal operation (aka streams) it may be the only way to go. Or maybe using one iterator() would be better overall.
Consider the following:
Set<String> set = ['foo','bar','baz'] def (foo, bar, baz) = set // inefficient; requires 3 iterators and 6 calls to next Stream<String> stream = ['foo','bar','baz'].stream() def (foo, bar, baz) = stream // not possible because `getAt(int)` is terminal
Attachments
Issue Links
- is related to
-
GROOVY-5744 Multiple assignment from Iterator skips every other element
- Closed
-
GROOVY-10473 Extend streams support to spread and subscript
- Closed