Issue Details (XML | Word | Printable)

Key: GROOVY-2492
Type: Improvement Improvement
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Paul King
Reporter: Mike Dillon
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
groovy

Allow Map.eachWithIndex to be called with a three-arg closure

Created: 10/Jan/08 11:09 PM   Updated: 08/Feb/08 01:26 AM
Component/s: None
Affects Version/s: None
Fix Version/s: 1.5.2

Time Tracking:
Not Specified

File Attachments: 1. File eachWithIndex-key-value.diff (3 kB)


Testcase included: yes
Patch Submitted: Yes


 Description  « Hide
If eachWithIndex is called on a Map with a three-arg closure, a MissingMethodException is thrown. It would be better if the closure was passed the key, value, and index, similar to the change in behavior of Map.each when called with a one or two-arg closure.

I've attached a patch that makes this change and adds tests for eachWithIndex on a Map.



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Paul King added a comment - 11/Jan/08 06:59 AM
Added, thanks again.

Paul King added a comment - 08/Feb/08 01:26 AM
close off release 1.5.4