Details
-
Type:
Improvement
-
Status:
Open
-
Priority:
Minor
-
Resolution: Unresolved
-
Affects Version/s: 1.5.6
-
Fix Version/s: None
-
Component/s: groovy-jdk
-
Labels:None
-
Environment:linux
-
Number of attachments :
Description
Running the following code:
def list = [1, 2, 3, 4, 5]
println list[-1] //Displays 5
list.remove(-1) //Throws exception. Should be consistent with above
println list //Never gets here due to exception but the expected output is [1, 2, 3, 4]
produces unexpected results. I would expect list.remove to be able to accept negative indices, just as the [] notation allows me to.