You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (Jira)" <ji...@apache.org> on 2022/02/03 22:52:00 UTC
[jira] [Closed] (GROOVY-3036) ArrayList.remove not consistent with subscript notation
[ https://issues.apache.org/jira/browse/GROOVY-3036?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Paul King closed GROOVY-3036.
-----------------------------
> ArrayList.remove not consistent with subscript notation
> -------------------------------------------------------
>
> Key: GROOVY-3036
> URL: https://issues.apache.org/jira/browse/GROOVY-3036
> Project: Groovy
> Issue Type: Improvement
> Components: groovy-jdk
> Affects Versions: 1.5.6
> Environment: linux
> Reporter: Tin Pavlinic
> Priority: Minor
>
> Running the following code:
> {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]
> {code}
> produces unexpected results. I would expect list.remove to be able to accept negative indices, just as the [] notation allows me to.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)