You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Lari Hotari (JIRA)" <ji...@apache.org> on 2015/09/24 22:24:04 UTC

[jira] [Commented] (GROOVY-7602) Intersect returns an empty list when the contents of the compared Collections are Maps

    [ https://issues.apache.org/jira/browse/GROOVY-7602?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14906937#comment-14906937 ] 

Lari Hotari commented on GROOVY-7602:
-------------------------------------

problem might be caused by https://github.com/apache/incubator-groovy/commit/4a5bb22d change (GROOVY-7267).

> Intersect returns an empty list when the contents of the compared Collections are Maps
> --------------------------------------------------------------------------------------
>
>                 Key: GROOVY-7602
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7602
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 2.3.11
>         Environment: Mac OS X 10.9.5
> Oracle Java 1.8.0_60
>            Reporter: Justin Guertin
>
> When I compare two lists with intersect and both lists contain maps I do not get any results, even if the contents are equivalent. The test fails in Groovy 2.3.11, but passes in 2.3.7.
> {code}
> import org.junit.Test
> class IntersectTest {
>     @Test
>     void testIntersect() {
>         def list1 = [[language: 'Java'], [language: 'Groovy'], [language: 'Scala']]
>         def list2 = [[language: 'Groovy'], [language: 'JRuby'], [language: 'Java']]
>         def intersection = list1.intersect(list2)
>         assert list1[0] == list2[2] // proves that there should be intersecting values
>         println "Intersection: $intersection"
>         assert intersection == [[language: 'Groovy'], [language: 'Java']]
>     }
> }
> {code}
> The intersect call returns an empty list in 2.3.11, resulting in the following output:
> {code}
> Intersection: []
> Assertion failed: 
> assert intersection == [[language: 'Groovy'], [language: 'Java']]
>        |            |
>        []           false
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)