[ 
https://issues.apache.org/jira/browse/GROOVY-9710?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Sam Gleske updated GROOVY-9710:
-------------------------------
    Component/s: groovy-runtime

> List.intersect changes behavior from Groovy 2.4 and Groovy 2.5+
> ---------------------------------------------------------------
>
>                 Key: GROOVY-9710
>                 URL: https://issues.apache.org/jira/browse/GROOVY-9710
>             Project: Groovy
>          Issue Type: Bug
>          Components: groovy-runtime
>    Affects Versions: 3.0.5, 2.5.13
>            Reporter: Sam Gleske
>            Priority: Major
>
> h2. Description
> List.intersect preserves the ordering of the source list in Groovy 2.4 but 
> instead takes the ordering of the intersecting list. This can lead to 
> unexpected behavior in Groovy applications as code migrates to newer versions 
> of Groovy.
> h2. Example code
> {code:java}
> // Passes assertion in Groovy 2.4.20 but fails in Groovy 2.5.13 and 3.0.5
> 0
> assert ['a', 'b'].intersect(['c', 'b', 'a']) == ['a', 'b']{code}
> h2. Expected behavior
> The order of the first list is preserved.
> h2. Actual behavior
> The order of the second list takes precedence.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to